linuxunixshellksh

Are there "Goto"s in UNIX KSH scripts?


Is there a way within a KSH to exit a case statement and go to a certain line for next execution with the code? Or are there goto labels you can use? Anything like this used instead of nesting tons of branching?


Solution

  • There are no labels or goto. However, you can exit a deeply-nested loop by passing a number to the "break" builtin: break 2 to exit two levels, break 3 to exit three levels, etc.