I can read the numbers and operation in with:
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
...or...
echo `$num1`+`$num2`;;
# results in: ...line 9: 1: command not found
Seems like I'm getting strings still perhaps when I try add add ("2+2" instead of "4").
case
or anything except one line:echo $num+$num
, since that will reproduce the problem exactly. The idea with minimizing context in programming questions is explained here: sscce.org