I'm making a simple bash calculator:
while [ 1 -eq 1 ]
read arg1 op arg2
if [[ "$arg1" -eq "exit" ]]
flag=0 for ops in + - * / % ** do if [[ "$op" = "$ops" ]] then flag=1 fi done if [[ $flag = 1 ]] then let "result = $arg1 $op $arg2" echo "$result" else echo "error" fi
The point is, at the entrance, I'm giving three meanings, arguments and surgery between them. For example,
12 + 5♪
Everything's working well except operations.
What's the matter?
for ops in + - * / % **
**I'd like all the arguments:
for ops in '+' '-' '*' '/' '%' '**'
Then the shell won't try to to do anything.