https://unix.stackexchange.com/questions/93029/how-can-i-add-subtract-etc-two-numbers-with-bash
echo "First number please"
read num1
echo "Second number please"
read num2
echo "Operation?"
read op
but then all my attempts to add the numbers fail:
case "$op" in
"+")
echo num1+num2;;
"-")
echo `num1-num2`;;
esac
Run:
First number please
1
Second mumber please
2
Operation?
+
Output:
num1+num2
...or...
echo $num1+$num2;;
# results in: 1+2
No comments:
Post a Comment