How to make a WHILE loop iterate over script until user input stops
howdy,
Total newb here. I am learning bash scripting and am in the dark about this one. I need the while loop to prompt the user AFTER the initial running of the script, if they want to do it again or not. If so, run the script again and if not, display a simple message stating script halted by user and then exit. Here's what I have and it works accept for the stupid while loop which I am not sure where to put...top or bottom. Any helpful nudges or tips would be great. If you feel like explaining all of this, even better! I have a degree in English, which means I've been a bartender for 20 years. Code:
#!/bin/bash |
http://tldp.org/LDP/Bash-Beginners-G...ect_09_05.html
your read is in the wrong place. can be written like this, when you've discovered where to place it. (check link above) Code:
read -p "Do you wish to enter another set of scores? (y/n) " CHOICE |
Derrrr...thank you. You rule.
|
If you really want the "continue" question at the very beginning (and between subsequent cycles), then you can include it between while and do
Code:
while But maybe you do not want it at the very beginning? Then it should be a while true and a late question with a conditional break Code:
while : |
All times are GMT -5. The time now is 01:18 PM. |