Files
oldlinux-files/Ref-docs/POSIX/susv3/utilities/exit.html
2024-02-19 00:21:47 -05:00

198 lines
4.8 KiB
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 The Open Group, All Rights Reserved -->
<title>exit</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="exit"></a> <a name="tag_04_47"></a><!-- exit -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_04_47_01"></a>NAME</h4>
<blockquote>exit - cause the shell to exit</blockquote>
<h4><a name="tag_04_47_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>exit</tt> <b>[</b><i>n</i><b>]</b></code></p>
</blockquote>
<h4><a name="tag_04_47_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>exit</i> utility shall cause the shell to exit with the exit status specified by the unsigned decimal integer <i>n</i>.
If <i>n</i> is specified, but its value is not between 0 and 255 inclusively, the exit status is undefined.</p>
<p>A <a href="../utilities/trap.html"><i>trap</i></a> on <b>EXIT</b> shall be executed before the shell terminates, except when the
<i>exit</i> utility is invoked in that <a href="../utilities/trap.html"><i>trap</i></a> itself, in which case the shell shall exit
immediately.</p>
</blockquote>
<h4><a name="tag_04_47_04"></a>OPTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_05"></a>OPERANDS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_06"></a>STDIN</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_07"></a>INPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_08"></a>ENVIRONMENT VARIABLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_09"></a>ASYNCHRONOUS EVENTS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_10"></a>STDOUT</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_11"></a>STDERR</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_12"></a>OUTPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_13"></a>EXTENDED DESCRIPTION</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_14"></a>EXIT STATUS</h4>
<blockquote>
<p>The exit status shall be <i>n</i>, if specified. Otherwise, the value shall be the exit value of the last command executed, or
zero if no command was executed. When <i>exit</i> is executed in a <a href="../utilities/trap.html"><i>trap</i></a> action, the
last command is considered to be the command that executed immediately preceding the <a href=
"../utilities/trap.html"><i>trap</i></a> action.</p>
</blockquote>
<h4><a name="tag_04_47_15"></a>CONSEQUENCES OF ERRORS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_04_47_16"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_17"></a>EXAMPLES</h4>
<blockquote>
<p>Exit with a <i>true</i> value:</p>
<pre>
<tt>exit 0
</tt>
</pre>
<p>Exit with a <i>false</i> value:</p>
<pre>
<tt>exit 1
</tt>
</pre>
</blockquote>
<h4><a name="tag_04_47_18"></a>RATIONALE</h4>
<blockquote>
<p>As explained in other sections, certain exit status values have been reserved for special uses and should be used by
applications only for those purposes:</p>
<dl compact>
<dt>&nbsp;126</dt>
<dd>A file to be executed was found, but it was not an executable utility.</dd>
<dt>&nbsp;127</dt>
<dd>A utility to be executed was not found.</dd>
<dt>&gt;128</dt>
<dd>A command was interrupted by a signal.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_47_19"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_47_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_47_21"></a>CHANGE HISTORY</h4>
<blockquote>
<p>None.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; 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>