We have to make a script with one
until loop to repeatedly ask
the user for a number.
- If the number is not 50, display the message, “Wrong number; try again.”
- ask for another number.
- If the number is 50, display the message, “You got it!” and stop.
Here is what I have so far:
echo -n "please choose a number: " read number until [$number -eq 50]; do if [$number !=50] then echo "Wrong number; try again" read wrong else echo -n "Please choose a number: " read newnum fi done
I'm not sure how to loop the "Please choose a number" statement. I always end up with the error:
syntax error near unexpected token 'fi'
I've been looking online, but there are no clear examples of input output UNTIL loops