{"id":5746,"date":"2022-12-20T18:57:31","date_gmt":"2022-12-20T21:57:31","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/break-man1p\/"},"modified":"2022-12-20T18:57:31","modified_gmt":"2022-12-20T21:57:31","slug":"break-man1p","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/break-man1p\/","title":{"rendered":"BREAK (man1p)"},"content":{"rendered":"<h1 align=\"center\">BREAK<\/h1>\n<p> <a href=\"#PROLOG\">PROLOG<\/a><br \/> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#OPERANDS\">OPERANDS<\/a><br \/> <a href=\"#STDIN\">STDIN<\/a><br \/> <a href=\"#INPUT FILES\">INPUT FILES<\/a><br \/> <a href=\"#ENVIRONMENT VARIABLES\">ENVIRONMENT VARIABLES<\/a><br \/> <a href=\"#ASYNCHRONOUS EVENTS\">ASYNCHRONOUS EVENTS<\/a><br \/> <a href=\"#STDOUT\">STDOUT<\/a><br \/> <a href=\"#STDERR\">STDERR<\/a><br \/> <a href=\"#OUTPUT FILES\">OUTPUT FILES<\/a><br \/> <a href=\"#EXTENDED DESCRIPTION\">EXTENDED DESCRIPTION<\/a><br \/> <a href=\"#EXIT STATUS\">EXIT STATUS<\/a><br \/> <a href=\"#CONSEQUENCES OF ERRORS\">CONSEQUENCES OF ERRORS<\/a><br \/> <a href=\"#APPLICATION USAGE\">APPLICATION USAGE<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#RATIONALE\">RATIONALE<\/a><br \/> <a href=\"#FUTURE DIRECTIONS\">FUTURE DIRECTIONS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>PROLOG <a name=\"PROLOG\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This manual page is part of the POSIX Programmer\u2019s Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">break \u2014 exit from for, while, or until loop<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">break <b>[<\/b><i>n<\/i><b>]<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>n<\/i> is specified, the <i>break<\/i> utility shall exit from the <i>n<\/i>th enclosing <b>for<\/b>, <b>while<\/b>, or <b>until<\/b> loop. If <i>n<\/i> is not specified, <i>break<\/i> shall behave as if <i>n<\/i> was specified as 1. Execution shall continue with the command immediately following the exited loop. The value of <i>n<\/i> is a positive decimal integer. If <i>n<\/i> is greater than the number of enclosing loops, the outermost enclosing loop shall be exited. If there is no enclosing loop, the behavior is unspecified.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A loop shall enclose a <i>break<\/i> or <i>continue<\/i> command if the loop lexically encloses the command. A loop lexically encloses a <i>break<\/i> or <i>continue<\/i> command if the command is:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>Executing in the same execution environment (see <i>Section 2.12<\/i>, <i>Shell Execution Environment<\/i>) as the compound-list of the loop\u2019s do-group (see <i>Section 2.10.2<\/i>, <i>Shell Grammar Rules<\/i>), and<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>Contained in a compound-list associated with the loop (either in the compound-list of the loop\u2019s do-group or, if the loop is a <b>while<\/b> or <b>until<\/b> loop, in the compound-list following the <b>while<\/b> or <b>until<\/b> reserved word), and<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>Not in the body of a function whose function definition command (see <i>Section 2.9.5<\/i>, <i>Function Definition Command<\/i>) is contained in a compound-list associated with the loop.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>n<\/i> is greater than the number of lexically enclosing loops and there is a non-lexically enclosing loop in progress in the same execution environment as the <i>break<\/i> or <i>continue<\/i> command, it is unspecified whether that loop encloses the command.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>OPERANDS <a name=\"OPERANDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">See the DESCRIPTION.<\/p>\n<h2>STDIN <a name=\"STDIN\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Not used.<\/p>\n<h2>INPUT FILES <a name=\"INPUT FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>ENVIRONMENT VARIABLES <a name=\"ENVIRONMENT VARIABLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>ASYNCHRONOUS EVENTS <a name=\"ASYNCHRONOUS EVENTS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Default.<\/p>\n<h2>STDOUT <a name=\"STDOUT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Not used.<\/p>\n<h2>STDERR <a name=\"STDERR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The standard error shall be used only for diagnostic messages.<\/p>\n<h2>OUTPUT FILES <a name=\"OUTPUT FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXTENDED DESCRIPTION <a name=\"EXTENDED DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXIT STATUS <a name=\"EXIT STATUS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">0<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"80%\">\n<p style=\"margin-top: 1em\">Successful completion.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p>>0<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"80%\">\n<p>The <i>n<\/i> value was not an unsigned decimal integer greater than or equal to 1.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>CONSEQUENCES OF ERRORS <a name=\"CONSEQUENCES OF ERRORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Default.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>The following sections are informative.<\/i><\/p>\n<h2>APPLICATION USAGE <a name=\"APPLICATION USAGE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">for i in bodies manpages.csv script_extrae_body.sh script.sh usr <br \/> do <br \/> if test -d &#8220;$i&#8221; <br \/> then break <br \/> fi <br \/> done<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The results of running the following example are unspecified: there are two loops in progress when the <i>break<\/i> command is executed, and they are in the same execution environment, but neither loop is lexically enclosing the <i>break<\/i> command. (There are no loops lexically enclosing the <i>continue<\/i> commands, either.)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">foo() { <br \/> for j in 1 2; do <br \/> echo &#8216;break 2&#8217; >\/tmp\/do_break <br \/> echo &#8221; sourcing \/tmp\/do_break ($j)&#8230;&#8221; <br \/> # the behavior of the break from running the following command <br \/> # results in unspecified behavior: <br \/> . \/tmp\/do_break<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">do_continue() { continue 2; } <br \/> echo &#8221; running do_continue ($j)&#8230;&#8221; <br \/> # the behavior of the continue in the following function call <br \/> # results in unspecified behavior (if execution reaches this <br \/> # point): <br \/> do_continue<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">trap &#8216;continue 2&#8217; USR1 <br \/> echo &#8221; sending SIGUSR1 to self ($j)&#8230;&#8221; <br \/> # the behavior of the continue in the trap invoked from the <br \/> # following signal results in unspecified behavior (if <br \/> # execution reaches this point): <br \/> kill -s USR1 $$ <br \/> sleep 1 <br \/> done <br \/> } <br \/> for i in 1 2; do <br \/> echo &#8220;running foo ($i)&#8230;&#8221; <br \/> foo <br \/> done<\/p>\n<h2>RATIONALE <a name=\"RATIONALE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In early proposals, consideration was given to expanding the syntax of <i>break<\/i> and <i>continue<\/i> to refer to a label associated with the appropriate loop as a preferable alternative to the <i>n<\/i> method. However, this volume of POSIX.1-2017 does reserve the name space of command names ending with a <colon>. It is anticipated that a future implementation could take advantage of this and provide something like:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">outofloop: for i in a b c d e <br \/> do <br \/> for j in 0 1 2 3 4 5 6 7 8 9 <br \/> do <br \/> if test -r &#8220;${i}${j}&#8221; <br \/> then break outofloop <br \/> fi <br \/> done <br \/> done<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">and that this might be standardized after implementation experience is achieved.<\/p>\n<h2>FUTURE DIRECTIONS <a name=\"FUTURE DIRECTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>Section 2.14<\/i>, <i>Special Built-In Utilities<\/i><\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology &#8212; Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http:\/\/www.opengroup.org\/unix\/online.html .<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https:\/\/www.kernel.org\/doc\/man-pages\/reporting_bugs.html .<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  break \u2014 exit from for, while, or until loop <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3782,1],"tags":[2552,2511],"class_list":["post-5746","post","type-post","status-publish","format-standard","hentry","category-1p-posix-comandos-generales","category-sin-categoria","tag-break","tag-man1p"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=5746"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5746\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=5746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=5746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=5746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}