| | |
converting centigrade to fahrenheit unix
![]() |
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Hey There,
To convert Celsius to Fahrenheit, multiply by 1.8 and add 32 degrees.
Hope that helps you get where you're going.
To convert Celsius to Fahrenheit, multiply by 1.8 and add 32 degrees.
Hope that helps you get where you're going.
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Hey There,
If you're using bash, you can just do this (pseudocode to follow)
and then call it from the script with
Inside the function, the arg's that you pass on the command line (arg1, arg2, etc) would be $1, $2, etc.
, Mike
If you're using bash, you can just do this (pseudocode to follow)
Shell Scripting Syntax (Toggle Plain Text)
function MYFUNCTION { code in here return $answer }
and then call it from the script with
Shell Scripting Syntax (Toggle Plain Text)
MYFUNCTION arg1 arg2, etc
Inside the function, the arg's that you pass on the command line (arg1, arg2, etc) would be $1, $2, etc.
, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
I have the same damn homework, this is easy.
The subfunction is the datafile or the numbers you have to convert.
Place it in some type of while, for, or until loop. I found that the for loop is easiest way to go.
now to calculate the numbers you must place all of this in a $variable
Like : $c and $f
And use either let, expr, or bc to do the math for ya.
Here's a big hint. From the commandline type:
now calculate $i (or what ever $varible you used) with the formula for centigrade and fahrenheit .
Easy!
The subfunction is the datafile or the numbers you have to convert.
Place it in some type of while, for, or until loop. I found that the for loop is easiest way to go.
now to calculate the numbers you must place all of this in a $variable
Like : $c and $f
And use either let, expr, or bc to do the math for ya.
Here's a big hint. From the commandline type:
Shell Scripting Syntax (Toggle Plain Text)
for i in `cat name of data file or temp file` do echo $i done
now calculate $i (or what ever $varible you used) with the formula for centigrade and fahrenheit .
Easy!
![]() |
Other Threads in the Shell Scripting Forum
- Previous Thread: Help in creating a user in Multiple servers
- Next Thread: can you create a script in windows
| Thread Tools | Search this Thread |





