The How-To Geek Forums Have Migrated to Discourse


How-To Geek Forums / Apple / OS X

Mac Shell Scripting Help

(1 post)
  • Started 5 years ago by sapola57
  • Topic Viewed 841 times

PARTNER SPOTLIGHT

Recommended: Clean Your Mac the Easy Way with CleanMyMac 3

If you want to clean up your Mac the easy way, CleanMyMac is a great tool to get the job done easily, and it will even keep your computer clean automatically.

Unlike the competition, it also includes great tools like a Clean Uninstaller, to get rid of applications and clean up the junk that they leave behind. All with the click of a button.

Download CleanMyMac 3 for Free Today

Posted yesterday 
Top
sapola57
Posts: 2

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!"
else
* Loop back to "Enter Password" *
fi

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 5 years ago
Top
 



Topic Closed

This topic has been closed to new replies.