The continue built-in skips an iteration of a loop being executed.
Syntax
-
continue [nest]
-
continue -i
Description
When executed without the -i
(--iteration
) option, the built-in aborts the
current iteration of for,
while, or until
loop and starts the next iteration of the loop.
When executed in nested loops, it affects the nestth innermost loop.
The default nest is one.
If the number of currently executed nested loops is less than nest, the
built-in affects the outermost loop.
When executed with the -i
(--iteration
) option, the built-in aborts the
current iteration of (innermost) iterative execution.
Options
-
-i
-
--iteration
-
Skip an iterative execution instead of a loop.
Operands
- nest
-
The nestth innermost loop is affected. nest must be a positive integer.
Exit status
The exit status of the continue built-in is:
-
zero if loop iteration was successfully skipped.
-
that of the command that was executed just before the continue built-in if iterative execution was successfully skipped.
Notes
The continue built-in is a special built-in.
The POSIX standard defines no options for the continue built-in; the built-in accepts no options in the POSIXly-correct mode.
Treatment of currently executed loops that are not lexically enclosing the continue built-in is unspecified in POSIX. Examples of such loops include:
Yash does not allow continuing such loops.