Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX script GOTO statement

Status
Not open for further replies.

rondebbs

MIS
Dec 28, 2005
109
US
Hello,

Can I use a GOTO statement in a script? If I run the code below I get an error that says GOTO not found - done:exit not found. I'm trying to use GOTO in a larger script when I want to branch around some code.

echo "line1"

if [ -z "$1" ]
then
GOTO done
else
GOTO done
fi

echo "line2"
done:exit
 
What part of GOTO not found is it that you don't understand?

What is done? You can create a function called done. You can exit if that what done is. What is done:exit?

There are many tutorials on ksh or bash, read one.
 
Use case instead of goto

Many happy hours spent in computer shops typing in my (much) younger days

10 print "mike"
20 goto 10

Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top