KSH doubt !!!

Hello !

Dears, somebody could say me how can I use the command
"goto" in the korn shell (ksh) script ??

In the site "www.kornshell.com", we see that the syntax is:
goto my_label
...
my_label:

However when I use this syntax, the following error occurs:
goto: not found

Somebody can help me?

Danke
Wittgeinster

The korn shell does not have a "goto". I looked on that site and I could find no claim to the contrary. Could you post the exact url where you found the goto syntax?

The URL is : http://cdfinfo.in2p3.fr/Services/Informatique/DOCU/munix.html

Press Ctrl+F and type goto ...

Danke,
Wittgeinster

That is just a web site with an error. But that's quite a bit different than your original comment that www.kornshell.com said that. www.kornshell.com is Dr. Korn's own website. It would be very strange indeed for him to make that error.

Witt,

A very nice construct that is far superior to GOTO is CASE. CASE also prevents dead ends and allows for many outcomes depending on the variable.

You can set it up to have infinite conditions, 256 max I believe, to perform various tasks depending on the input to the CASE statement.

Just define $VAR above from some action and CASE will do the rest!

case $VAR in

VAR1 ) Do some statement ;;

VAR2 ) Do different statement ;;

VAR3 ) Do another different statement;;

  • ) Do default statement and exit from CASE ;;

esac

:smiley: :cool:

Thank you Kelam_Magnus !!

Perderabo,
so that I could have access that one hyperlink, I made the following procedure :

hyperlink : Resoursces
hyperlink : Unix KornShell Memento

Thank you !!

Witt