Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Author - MR
- #Date modified - 1/29/14
- until [ "$choice" == "3" ]
- do
- echo "What do you want to convert?"
- echo "============================"
- echo "1. Celsius to Fahrenheit"
- echo "2. Fahrenheit to Celsius"
- echo "3. Exit"
- echo "============================"
- echo
- echo -n "Enter choice: "
- read choice
- echo
- fah_to_cel()
- {
- echo -n "Enter fahrenheit: "
- read fah
- a=32
- b=0.56
- echo -n "$fah FAHRENHEIT in CELSIUS is: "
- echo -n "$fah $a $b" | awk '{ print ($1-$2) * $3 }'
- echo
- }
- cel_to_fah()
- {
- echo -n "Enter celsius: "
- read cel
- c=1.8
- d=32
- echo -n "$cel CELSIUS in FAHRENHEIT is: "
- echo -n "$cel $c $d" | awk '{ print ($1*$2) + $3 }'
- echo
- }
- if [ "$choice" == "1" ]
- then
- fah_to_cel
- elif [ "$choice" == "2" ]
- then
- cel_to_fah
- elif [ "$choice" == "3" ]
- then
- echo "Goodbye"
- echo
- else
- echo "Invalid choice"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement