I am new here and hope my question is not so noob. I am learning shell programming. My following script giving me error. I cannot seem to figure out why
#!/bin/bash
#This is our sixth script switch.
echo "Print two numbers"
read num1 num2
echo "What operation do you want to do?"
operations=’add subtract multiply divide exponentiate modulo all quit’
select oper in $operations ; do
case $oper in
"add" ) echo "$num1 + $num2 =" $[$num1 + $num2] ;;
"subtract" ) echo "$num1- $num2 =" $[$num1- $num2] ;;
"multiply" ) echo "$num1 * $num2 =" $[$num1 * $num2] ;;
"exponentiate" ) echo "$num1 ** $num2 =" $[$num1 ** $num2] ;;
"divide" ) echo "$num1 / $num2 =" $[$num1 / $num2] ;;
"modulo" ) echo "$num1 % $num2 =" $[$num1 % $num2] ;;
"all" )
echo "$num1 + $num2 =" $[$num1 + $num2]
echo "$num1- $num2 =" $[$num1- $num2]
echo "$num1 * $num2 =" $[$num1 * $num2] echo "$num1 ** $num2 =" $[$num1 ** $num2]
echo "$num1 / $num2 =" $[$num1 / $num2] echo "$num1 % $num2 =" $[$num1 % $num2]
*)
exit ;;
esac
done
When I run it shows
$ ./script6.txt
Print two numbers
22 22
What operation do you want to do?
./script6.txt: line 7: subtract: command not found
./script6.txt: line 21: syntax error near unexpected token `)'
./script6.txt: line 21: `
Thanks in advance