Home OS X
OS X Syntax

while

Execute commands

SYNTAX
      while (expr)
      ...
      end     

Execute the commands between while and the matching end while expr evaluates non-zero.

while and end must appear alone on their input lines.

break and continue may be used to terminate or continue the loop prematurely. If the input is a terminal, the user is prompted the first time through the loop as with foreach.

"God shows his contempt for wealth by the kind of person he selects to receive it" - Austin O'Malley

Related commands:

break - Exit from a loop
continue - Resume the next iteration of a while or foreach loop.
repeat - Execute a command multiple times
foreach - Loop, expand words, and execute commands

Equivalent BASH command:

while - Execute commands



Back to the Top

Simon Sheppard
SS64.com