So everything in my code works, all but the multiplication one(*)
ex4.sh: line 23: [: too many arguments
ex4.sh: line 26: [: too many arguments
ex4.sh: line 29: [: too many arguments
ex4.sh: line 32: [: too many arguments
Heres the script it asks you for a 2 numbers entered separately then an operation + being addition - being subtraction / being division and * being multiplication. Everything works all but multiplication which gives a too many arguments error
echo First number
read NUM1
if ! [[ "$NUM1" =~ ^[0-9]+$ ]]; then
echo Integers only please
else
echo Second number
read NUM2
if ! [[ "$NUM2" =~ ^[0-9]+$ ]]; then
echo Integers only please
else
echo What operation would you like to do?+/-*
read OPERATION
if [ $OPERATION = "+" ]; then
echo Answer
expr $NUM1 + $NUM2
elif [ $OPERATION = "/" ]; then
echo Answer
expr $NUM1 / $NUM2
elif [ $OPERATION = "-" ]; then
echo Answer
expr $NUM1 - $NUM2
elif [ $OPERATION = "*" ]; then
echo Answer
expr $NUM1 * $NUM2
else
echo Please enter one of +/-*
fi
fi
fi