1BREAK(P) POSIX Programmer's Manual BREAK(P)
2
3
4
6 break - exit from for, while, or until loop
7
9 break [n]
10
12 The break utility shall exit from the smallest enclosing for, while, or
13 until loop, if any; or from the nth enclosing loop if n is specified.
14 The value of n is an unsigned decimal integer greater than or equal to
15 1. The default shall be equivalent to n=1. If n is greater than the
16 number of enclosing loops, the outermost enclosing loop shall be
17 exited. Execution shall continue with the command immediately following
18 the loop.
19
21 None.
22
24 See the DESCRIPTION.
25
27 Not used.
28
30 None.
31
33 None.
34
36 Default.
37
39 Not used.
40
42 The standard error shall be used only for diagnostic messages.
43
45 None.
46
48 None.
49
51 0 Successful completion.
52
53 >0 The n value was not an unsigned decimal integer greater than or
54 equal to 1.
55
56
58 Default.
59
60 The following sections are informative.
61
63 None.
64
66 for i in * do
67 if test -d "$i" then break fi done
68
70 In early proposals, consideration was given to expanding the syntax of
71 break and continue to refer to a label associated with the appropriate
72 loop as a preferable alternative to the n method. However, this volume
73 of IEEE Std 1003.1-2001 does reserve the name space of command names
74 ending with a colon. It is anticipated that a future implementation
75 could take advantage of this and provide something like:
76
77
78 outofloop: for i in a b c d e
79 do
80 for j in 0 1 2 3 4 5 6 7 8 9
81 do
82 if test -r "${i}${j}"
83 then break outofloop
84 fi
85 done
86 done
87
88 and that this might be standardized after implementation experience is
89 achieved.
90
92 None.
93
95 Special Built-In Utilities
96
98 Portions of this text are reprinted and reproduced in electronic form
99 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100 -- Portable Operating System Interface (POSIX), The Open Group Base
101 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
102 Electrical and Electronics Engineers, Inc and The Open Group. In the
103 event of any discrepancy between this version and the original IEEE and
104 The Open Group Standard, the original IEEE and The Open Group Standard
105 is the referee document. The original Standard can be obtained online
106 at http://www.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group 2003 BREAK(P)