Execute commands

      while list; do list; done

until list; do list; done

The while command continuously executes the do list 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 list is executed as long as the last command in list returns a non-zero exit status.

The exit status of the while and until commands is the exit status of the last do list command executed, or zero if none was executed.

"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

Copyright © SS64.com 1999-2018
Some rights reserved