-1

I am trying to explore bash script using Linux Mint and I want to try conditional statement of math operation. But I am now stuck on error.

Here is the code

echo "Enter First Number: "
read numl 
echo "Enter Second Number: " 
read num2 
echo "Choose Operation Below" 
echo "1-Addition, 2-Subtraction, 3-Multiplication, 4-Division" 
read opr 

if [$opr == $(1)]
then 
    $answer=$((numl+num2)) 
    echo "Answer is $answer" 
fi

Now, I am getting an error

main.bash: line 9: 1: command not found
main.bash: line 9: [1: command not found

Where did I go wrong?

Carl00001
  • 9
  • 3

0 Answers0