📄 return.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>return</title></head><body bgcolor="white"><basefont size="3"> <a name="return"></a> <a name="tag_04_120"></a><!-- return --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_120_01"></a>NAME</h4><blockquote>return - return from a function</blockquote><h4><a name="tag_04_120_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>return</tt> <b>[</b><i>n</i><b>]</b></code></p></blockquote><h4><a name="tag_04_120_03"></a>DESCRIPTION</h4><blockquote><p>The <i>return</i> utility shall cause the shell to stop executing the current function or <a href="../utilities/dot.html"><i>dot</i></a> script. If the shell is not currently executing a function or <a href="../utilities/dot.html"><i>dot</i></a> script, the results are unspecified.</p></blockquote><h4><a name="tag_04_120_04"></a>OPTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_05"></a>OPERANDS</h4><blockquote><p>See the DESCRIPTION.</p></blockquote><h4><a name="tag_04_120_06"></a>STDIN</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_120_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_120_10"></a>STDOUT</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_120_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_120_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_14"></a>EXIT STATUS</h4><blockquote><p>The value of the special parameter <tt>'?'</tt> shall be set to <i>n</i>, an unsigned decimal integer, or to the exit status ofthe last command executed if <i>n</i> is not specified. If the value of <i>n</i> is greater than 255, the results are undefined.When <i>return</i> is executed in a <a href="../utilities/trap.html"><i>trap</i></a> action, the last command is considered to bethe command that executed immediately preceding the <a href="../utilities/trap.html"><i>trap</i></a> action.</p></blockquote><h4><a name="tag_04_120_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_120_16"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_17"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_18"></a>RATIONALE</h4><blockquote><p>The behavior of <i>return</i> when not in a function or <a href="../utilities/dot.html"><i>dot</i></a> script differs betweenthe System V shell and the KornShell. In the System V shell this is an error, whereas in the KornShell, the effect is the same as<a href="../utilities/exit.html"><i>exit</i></a>.</p><p>The results of returning a number greater than 255 are undefined because of differing practices in the various historicalimplementations. Some shells AND out all but the low-order 8 bits; others allow larger values, but not of unlimited size.</p><p>See the discussion of appropriate exit status values under <a href="exit.html#tag_04_47_15"><i>exit</i></a> .</p></blockquote><h4><a name="tag_04_120_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_120_20"></a>SEE ALSO</h4><blockquote><p><a href="xcu_chap02.html#tag_02_14"><i>Special Built-In Utilities</i></a></p></blockquote><h4><a name="tag_04_120_21"></a>CHANGE HISTORY</h4><h4><a name="tag_04_120_22"></a>Issue 6</h4><blockquote><p>IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/5 is applied so that the reference page sections use terms asdescribed in the Utility Description Defaults ( <a href="xcu_chap01.html#tag_01_11"><i>Utility Description Defaults</i></a> ). Nochange in behavior is intended.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -