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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skip some paragraphs in a script

Status
Not open for further replies.

Yanndewael

Programmer
Mar 14, 2003
12
GB
Hi again,

Here is my question:

In a script, I test the "return code" of a request as follow:
ls -1rt $directory | read file

if [[ $? -eq 0 ]] ; then
echo DIRECTORY NOT EMPTY.
GO to the §9
fi

As you certainly guessed, I'd like to know how to write the "GO to the §9"!! So if the directory is not empty, I want to skip some actions and go directly to a paragraph further...

Thank you in advance for your help!
 
As far as I know there is no "goto" equivalent in Korn shell.

Best to use:

[tt]if [[ $? -eq 0 ]] ; then
echo DIRECTORY NOT EMPTY.
# GO to the §9
else
do some other stuff
fi

# §9
the next paragraph[/tt]
Annihilannic.
 
Goto is only available in csh, I think.
At the risk of starting a long thread regards rights/wrongs of using goto/labels etc,I would suggest you plan your program properly (eg to use functions instead)
Also see thread822-433188 Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top