| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # break-levels.sh: Breaking out of loops. |
| 3 | |
| 4 | # "break N" breaks out of N level loops. |
| 5 | |
| 6 | for outerloop in 1 2 3 4 5 |
| 7 | do |
| 8 | echoscip-shell system . . echo. -n "Group $outerloop: " |
| 9 | |
| 10 | # -------------------------------------------------------- |
| 11 | for innerloop in 1 2 3 4 5 |
| 12 | do |
| 13 | echoscip-shell system . . echo. -n "$innerloop " |
| 14 | |
| 15 | if [scip-shell system . . `[`. "$innerloop" -eq 3 ] |
| 16 | then |
| 17 | break # Try break 2 to see what happens. |
| 18 | # ("Breaks" out of both inner and outer loops.) |
| 19 | fi |
| 20 | done |
| 21 | # -------------------------------------------------------- |
| 22 | |
| 23 | echoscip-shell system . . echo. |
| 24 | done |
| 25 | |
| 26 | echoscip-shell system . . echo. |
| 27 | |
| 28 | exit 0 |