mirror of
https://github.com/rawiriblundell/wiki.bash-hackers.org
synced 2024-12-25 06:00:41 +01:00
977 B
977 B
The until loop
Synopsis
until <LIST1> ; do
<LIST2>
done
Description
The until-loop is relatively simple in what it does: it executes the
command list <LIST1>
and if the exit
code of it was not 0 (FALSE) it executes <LIST2>
. This happens
again and again until <LIST1>
returns TRUE.
This is exactly the opposite of the while loop.
:!: Like all loops (both for
-loops, while
and until
), this loop
can be
- terminated (broken) by the
break
command, optionally asbreak N
to breakN
levels of nested loops - forced to immediately do the next iteration using the
continue
command, optionally ascontinue N
analog tobreak N
Return status
The return status is the one of the last command executed in <LIST2>
,
or 0
(TRUE
) if none was executed.
Examples
Portability considerations
See also
- Internal: The while loop