I know this is probably really easy and I am just putting to much thought into it but I need to create a Bash script that will convert Celsius to Fahrenheit with this equation:
f = (9/5)c+32
How would I do this? Using just expr doesn't work because it won't use floating point. How do I do this equation? Using bc?
If you want to use bc try this :
echo "9*$c/5+32" | bc -l
You (normally) don't need floating point arithmetic for this to work, if rounding errors are not critical and you don't need floating-point precision:
expr 9 '*' $c / 5 + 32
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With