1

Can expr deal with decimals?

view story
linux-howto

http://www.unix.com – Hello, Im trying to work on a small script for a formula converting temperatures, Celsius to fahrenheit. I have a formula, and it works.... it works every way I try it. But it keeps giving me the wrong results every time with expr. The formula for C to F would be: divide by 5, multiply by 9, add 32. So..... simple code here Code: read c f= `expr $c / 5 \* 9 + 32` echo $f The problem is, its never correct because expr can't seem to add the decimals right. For instance 32 degrees celcius. f=`expr 32 / 5 \* 9 + 32` gives me 86 for some reason. It should give 89 (or 89.6) I have als (HowTos)