Go to the previous, next section.

Looping Constructs

Note that wherever you see a `;' in the description of a command's syntax, it may be replaced indiscriminately with one or more newlines.

Bash supports the following looping constructs.

until
The syntax of the until command is:
until test-commands; do consequent-commands; done
Execute consequent-commands as long as the final command in test-commands has an exit status which is not zero.

while
The syntax of the while command is:
while test-commands; do consequent-commands; done

Execute consequent-commands as long as the final command in test-commands has an exit status of zero.

for
The syntax of the for command is:

for name [in words ...]; do commands; done
Execute commands for each member in words, with name bound to the current member. If "in words" is not present, "in "$@"" is assumed.

Go to the previous, next section.