The following loop is looping when number is less than 1 or greater than 45 but it fails when the answer includes special characters such as [ % & * # ] etc
What can I change in the code in order to support this issue?
a=1
b=45
while [[ $answer -lt $a ]] || [[ $answer -gt $b ]]
do
echo -n "please answer"
read answer
done
please answer./numfail.sh: line 11: read: answer$': not a valid identifier
– maulinglawns Jul 20 '17 at 14:56