The general form of the while loop is this:
while control-command
do
commands
done
Each cycle of the while loop, the shell attempts to execute the control command. If it returns a zero exit status (success), the commands between do and done are executed. This process continues until the control command yields a nonzero exit status (failure).
The general form of the until loop is this:
until control-command
do
commands
done
Each cycle of the until loop, the shell attempts to execute the control command. If it returns a nonzero exit status (failure), the commands between do and done are executed. This process continues until the control command yields a zero exit status (success).