December 1999
Beginner
528 pages
11h 10m
English
Occasionally when processing you may need to break out or skip certain iterations based on some form of criteria. To help you achieve this the shell provides two commands:
break
continue.
The break command allows you to break out of loops. Breaks are usually used to quit a loop or case statement after some form of processing. If you are inside a nested loop, you can specify how many loops you should break out of: for instance if you are in a loop within a loop (that’s two loops down), then issue break 2 to come right out.
Here’s an example. This script will loop forever until the user inputs a number above the number 5. To break out of this ...
Read now
Unlock full access