I am writing a script called pickanumber.sh. I was setting up the script so I will ask the user to pick a number. If the number that they type is not "8" than the script will continue running. I can't make the script keep running when the user picks a number other than "8". Should I use for loop or while loop? Here is the script that I have so far.
rand_num=0
let "rand_num = $RANDOM % 10 + 1"
echo $rand_num
echo -n "pick a number from 1 - 10! "
read pickanumber
if [ "$pickanumber" = "8" ]; then
echo "GOOD JOB"
else
read $pickanumber
fi