So practically for my assignment I need to break out of a true while loop when the user inputs a number that gives a modulus remainder of 0, ex: (25 % 5 = 0 break loop) Where in my attempt below have I gone wrong?
while true
do
echo "Please input anything here: "
read INPUT
if [ `expr $INPUT % 5` -eq 0 ]; then
echo "you entered wrong"
else
echo "you entered right"
break
fi
done
bash
, then you might consider using its built-in arithmetic expansion syntax e.g.(( INPUT % 5 == 0 ))