Hi I'm new to shell scripting and I'm not sure what's wrong here. If I run the program and choose addition, I get the error in the add() function and vice versa for subtraction (Sub() function). I tried using arithmetic expansion to fix the error (I accidentally posted from a guest account and couldn't log back in to delete it):sum=$(($1 + $2))sub=$(($1 - $2))This DID NOT work.  I still get the same error, except it said the error token is +  (or - for subtraction). What is the problem here? I've posted my entire code but i think the problem exists only in the add() and sub() functions.Thank youEdit: Also, I have #!/bin/bash in my code, but I didn't want to include it in the code below, but it's there when I run my code so it isn't the issue.Edit: I suspect that $2 is not being found, so when it calculates the $sum expression, it reads ($1 +  ). But I don't understand why it's not reading $2.function add(){echo mycalc $1 + $2 (($sum = $1 + $2))echo The sum of $1 plus $2 is $sum sleep 3clearexit}function sub(){echo mycalc $1 - $2 (($sub = $1 - $2))echo $1 minus $2 equals $sub sleep 3clearexit}choice=aif [ $# = 3 ] && [ $2 = '+' ] || [ $2 = '-' ]then if [ $2 = '+' ] && [ $1 -le 0 ] || [ $1 -ge 0 ] && [ $3 -le 0 ] || [ $3 -ge 0 ]then add $1 $3elif[ $2 = '-' ] && [ $1 -le 0 ] || [ $1 -ge 0 ] && [ $3 -le 0 ] || [ $3 -ge 0 ]then sub $1 $3elseecho Main Menusleep 3clearfielse while [ $choice != X ] && [ $choice != x ]doecho Please choose one of the following options echo C) Calculate  echo X) Exit read -p Option choiceif [ $choice = C ] || [ $choice = c ]then choice1=awhile [ $choice1 != X ] && [ $choice1 != x ] doread -p Please enter an integer or press X to exit. choice1if [ $choice1 = X ] || [ $choice1 = x ]thenecho Good bye sleep 3clearexitelif [ $choice1 -le 0 ] || [ $choice1 -ge 0 ]then action=awhile [ $action != X ] && [ $action != x ] doecho Please select an operationecho +) Addition echo -) Subtraction echo X) Exit read actionif [ $action = X ] || [ $action = x ]thenecho Good bye sleep 3clearexitelif [ $action = + ] || [ $action = a ] || [ $action = A ]thenread -p Please enter another number  num2add $1 $num2elif [ $action = - ] || [ $action = s ] || [ $action = S ]thenread -p Please enter another number  num2sub $1 $num2elseecho Invalid response, please try again sleep 3 clearfidoneelseecho Invalid response sleep 3clearfidoneelif [ choice = X ] || [ choice = x ]thenecho Good bye sleep 3clearexitelseecho Invalid responsesleep 3clearfidonefi
Syntax error: operand expected (error token is =1 + )
bash;shell script