2
# The "continue N" command, continuing at the Nth level loop.
4
for outer in I II III IV V # outer loop
6
echo; echo -n "Group $outer: "
8
# --------------------------------------------------------------------
9
for inner in 1 2 3 4 5 6 7 8 9 10 # inner loop
12
if [[ "$inner" -eq 7 && "$outer" = "III" ]]
14
continue 2 # Continue at loop on 2nd level, that is "outer loop".
15
# Replace above line with a simple "continue"
16
# to see normal loop behavior.
19
echo -n "$inner " # 7 8 9 10 will not echo on "Group III."
21
# --------------------------------------------------------------------
28
# Come up with a meaningful use for "continue N" in a script.