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

go to line? in a script 1

Status
Not open for further replies.

ozi403

Technical User
Apr 29, 2002
54
TR
Hi,

I have 25 lines script then I try to add an "if" loop so
in this loop, after "else" I want to go to 10.line, how can I?

thanks for your helps.
 
AFAIK, no shell have goto feature, and even needs one.
In the man page of your shell, pay attention to the looping mechanisms, like while, until and to case.
If you're still stuck, come back with what you have and what you can't do.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
In csh it is possible to use goto.

> goto mylabel
will continue after line that is marked
> mylabel:

Unfortunately afaik sch scripts are not recommended, but that is the shell I know best.
 
Perhaps function will work for you? (bash)
Code:
function foo {
   echo "foo"
}

echo "bar"
foo
echo "foobar"
foo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top