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
11

NAME

13       break — exit from for, while, or until loop
14

SYNOPSIS

16       break [n]
17

DESCRIPTION

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

OPTIONS

28       None.
29

OPERANDS

31       See the DESCRIPTION.
32

STDIN

34       Not used.
35

INPUT FILES

37       None.
38

ENVIRONMENT VARIABLES

40       None.
41

ASYNCHRONOUS EVENTS

43       Default.
44

STDOUT

46       Not used.
47

STDERR

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

OUTPUT FILES

52       None.
53

EXTENDED DESCRIPTION

55       None.
56

EXIT STATUS

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

CONSEQUENCES OF ERRORS

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

APPLICATION USAGE

69       None.
70

EXAMPLES

72       for i in *
73       do
74           if test −d "$i"
75           then break
76           fi
77       done
78

RATIONALE

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

FUTURE DIRECTIONS

101       None.
102

SEE ALSO

104       Section 2.14, Special Built-In Utilities
105
107       Portions  of  this text are reprinted and reproduced in electronic form
108       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
109       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
110       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
111       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
112       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
113       event of any discrepancy between this version and the original IEEE and
114       The Open Group Standard, the original IEEE and The Open Group  Standard
115       is  the  referee document. The original Standard can be obtained online
116       at http://www.unix.org/online.html .
117
118       Any typographical or formatting errors that appear  in  this  page  are
119       most likely to have been introduced during the conversion of the source
120       files to man page format. To report such errors,  see  https://www.ker
121       nel.org/doc/man-pages/reporting_bugs.html .
122
123
124
125IEEE/The Open Group                  2013                            BREAK(1P)
Impressum