Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

User Commands (a - b) break(1)
NAME
break - Exits from for, while, until, or select loop
SYNOPSIS
break [n]
DESCRIPTION
Exits from the enclosing for, while, until, or select loop, if any. If n is specied, breaks at the
nth enclosing level.
EXAMPLES
1. The following shell script demonstrates the use of the break command to exit from a
loop:
forxin12345
do
if [ $x != 3 ]
then
print $x
else
break
done
EXIT VALUES
If an invalid argument is specied, the exit value is greater than 0 (zero).
NOTES
Parameter assignment lists that precede the command remain in effect when the com-
mand completes.
I/O redirections are processed after parameter assignments.
Errors cause a script that contains the commands so marked to abort.
The break command is a shell built-in command. It differs from the regular commands in that it
does not open a new shell process when it executes.
A general discussion of shell built-in commands and a list of the OSS shell built-in commands
are in the reference page for sh(1).
RELATED INFORMATION
Commands: sh(1).
527188-004 Hewlett-Packard Company 137