while(1)
NAME
while, until − shell built-in functions to repetitively execute a set of actions while/until conditions are evaluated TRUE
SYNOPSIS
sh
while conditions ; do actions ; done
until conditions ; do actions ; done
csh
while (expr)
...
end
ksh
while conditions ; do actions ; done
until conditions ; do actions ; done
DESCRIPTION
sh
A while command repeatedly executes the while conditions and, if the exit status of the last command in the conditions list is zero, executes the do actions; otherwise the loop terminates. If no commands in the do actions are executed, then the while command returns a zero exit status; until may be used in place of while to negate the loop termination test.
csh
While expr is true (evaluates to nonzero), repeat commands between the while and the matching end statement. break and continue may be used to terminate or continue the loop prematurely. The while and end must appear alone on their input lines. If the shell’s input is a terminal, it prompts for commands with a question-mark until the end command is entered and then performs the commands in the loop.
ksh
A while command repeatedly executes the while conditions and, if the exit status of the last command in the conditions list is zero, executes the do actions; otherwise the loop terminates. If no commands in the do actions are executed, then the while command returns a zero exit status; until may be used in place of while to negate the loop termination test.
SEE ALSO
break(1), csh(1), ksh(1), sh(1)
NOTES
Both the Bourne shell, sh, and the Korn shell, ksh, can use the semicolon and the carriage return interchangeably in their syntax of the if, for, and while built-in commands.
SunOS 5.4 — Last change: 15 Apr 1994