Syntax while test-commands; do consequent-commands; done
until test-commands; do consequent-commands; done
The while command continuously executes the do consequent-commands as long as the last command in list returns an exit status of zero.
The until command is identical to the while command, except that the test is negated; the do consequent-commands is executed as long as the last command in test-commands returns a non-zero exit status.
The exit status of the while and until commands is the exit status of the last do consequent-commands command executed, or zero if none was executed.
This is a BASH shell builtin, to display your local syntax from the bash prompt type: help while
"God shows his contempt for wealth by the kind of person he selects to receive it" ~ Austin O'Malley
Related macOS commands:
break - Exit from a loop
continue - Resume the next iteration of a while or if loop.
for - Loop command.
until - Execute commands (until error)