I am looking for a way to return to a previous command in a shell script and carry on with the script from that point.
for example,

echo "Enter Password"
read answer
if [ $answer = hello ]; then
echo "Yay!"
* Loop back to "Enter Password" *

My scripty is more complicated in reality and contains multiple variables, but I just need a way to go back to a previous command and run the script from that point. Is this at all possible? Thank you for any help you can give.

Posted 6 years ago