lasercat_pow•

you're all good until you reach the expr part. There are several problems with that part.

  1. You can't do arithmetic like that in bash. Use bc instead.

  2. the assignment operator (=) must be placed after the variable being set. This part is not just true of bash, this is true of every programming language I know.

  3. When assigning a variable in bash, the variable should not be prefixed with $. Only use the $ prefix for retrieving the value of a variable.

  4. There cannot be any spaces between the assignment operator and the value being assigned in bash.

Here's something that would work for that line:

total=$(echo "$num1 + $num2" | bc)

I almost missed one other thing: the space in the shebang at the top of your script means this script will not necessarily run in bash.

1
[deleted]•

[deleted]

1
gasahold•

Don't you want -n with your input echo statements?

1
crocodileRookOP•

Probably. I have not been at this long enough to remember all of these kinds of tags.

​

thanks for your help.

1