1BREAK(1P)                  POSIX Programmer's Manual                 BREAK(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       break - exit from for, while, or until loop
13

SYNOPSIS

15       break [n]
16

DESCRIPTION

18       The break utility shall exit from the smallest enclosing for, while, or
19       until  loop,  if any; or from the nth enclosing loop if n is specified.
20       The value of n is an unsigned decimal integer greater than or equal  to
21       1.  The  default  shall  be equivalent to n=1. If n is greater than the
22       number of enclosing  loops,  the  outermost  enclosing  loop  shall  be
23       exited. Execution shall continue with the command immediately following
24       the loop.
25

OPTIONS

27       None.
28

OPERANDS

30       See the DESCRIPTION.
31

STDIN

33       Not used.
34

INPUT FILES

36       None.
37

ENVIRONMENT VARIABLES

39       None.
40

ASYNCHRONOUS EVENTS

42       Default.
43

STDOUT

45       Not used.
46

STDERR

48       The standard error shall be used only for diagnostic messages.
49

OUTPUT FILES

51       None.
52

EXTENDED DESCRIPTION

54       None.
55

EXIT STATUS

57        0     Successful completion.
58
59       >0     The n value was not an unsigned decimal integer greater than  or
60              equal to 1.
61
62

CONSEQUENCES OF ERRORS

64       Default.
65
66       The following sections are informative.
67

APPLICATION USAGE

69       None.
70

EXAMPLES

72              for i in * do
73                  if test -d "$i" then break fi done
74

RATIONALE

76       In  early proposals, consideration was given to expanding the syntax of
77       break and continue to refer to a label associated with the  appropriate
78       loop  as a preferable alternative to the n method. However, this volume
79       of IEEE Std 1003.1-2001 does reserve the name space  of  command  names
80       ending  with  a  colon.  It is anticipated that a future implementation
81       could take advantage of this and provide something like:
82
83
84              outofloop: for i in a b c d e
85              do
86                  for j in 0 1 2 3 4 5 6 7 8 9
87                  do
88                      if test -r "${i}${j}"
89                      then break outofloop
90                      fi
91                  done
92              done
93
94       and that this might be standardized after implementation experience  is
95       achieved.
96

FUTURE DIRECTIONS

98       None.
99

SEE ALSO

101       Special Built-In Utilities
102
104       Portions  of  this text are reprinted and reproduced in electronic form
105       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
106       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
107       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
108       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
109       event of any discrepancy between this version and the original IEEE and
110       The  Open Group Standard, the original IEEE and The Open Group Standard
111       is the referee document. The original Standard can be  obtained  online
112       at http://www.opengroup.org/unix/online.html .
113
114
115
116IEEE/The Open Group                  2003                            BREAK(1P)
Impressum