Hi everyone, i have made a very simple script where it reads the user input and converts the number from celcius to faranheit but instead of running the command and prompting the user for input I want to be able to simply enter a number at the end of the command to run the script.
ex. instead of using ./tempconvert
use ./tempconvert 100
I have googled and looked in my book and can't find out how to do this.
Thanks.
echo -n "Enter a temperature in Celcius:"
read temp
# formula tf=(9/5)*temp+32
tf=$(echo "scale=2;((9/5) * $temp) + 32" |bc)
echo "$temp degrees C is $tf degrees F"