mirror of https://github.com/mkerrisk/man-pages
119 lines
2.6 KiB
Groff
119 lines
2.6 KiB
Groff
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
||
|
.TH "EXIT" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
||
|
.\" exit
|
||
|
.SH NAME
|
||
|
exit \- cause the shell to exit
|
||
|
.SH SYNOPSIS
|
||
|
.LP
|
||
|
\fBexit\fP \fB[\fP\fIn\fP\fB]\fP
|
||
|
.SH DESCRIPTION
|
||
|
.LP
|
||
|
The \fIexit\fP utility shall cause the shell to exit with the exit
|
||
|
status specified by the unsigned decimal integer \fIn\fP.
|
||
|
If \fIn\fP is specified, but its value is not between 0 and 255 inclusively,
|
||
|
the exit status is undefined.
|
||
|
.LP
|
||
|
A \fItrap\fP on \fBEXIT\fP shall be executed before the shell terminates,
|
||
|
except when the
|
||
|
\fIexit\fP utility is invoked in that \fItrap\fP itself, in which
|
||
|
case the shell shall exit
|
||
|
immediately.
|
||
|
.SH OPTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH OPERANDS
|
||
|
.LP
|
||
|
See the DESCRIPTION.
|
||
|
.SH STDIN
|
||
|
.LP
|
||
|
Not used.
|
||
|
.SH INPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH ENVIRONMENT VARIABLES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH ASYNCHRONOUS EVENTS
|
||
|
.LP
|
||
|
Default.
|
||
|
.SH STDOUT
|
||
|
.LP
|
||
|
Not used.
|
||
|
.SH STDERR
|
||
|
.LP
|
||
|
The standard error shall be used only for diagnostic messages.
|
||
|
.SH OUTPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXTENDED DESCRIPTION
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXIT STATUS
|
||
|
.LP
|
||
|
The exit status shall be \fIn\fP, if specified. Otherwise, the value
|
||
|
shall be the exit value of the last command executed, or
|
||
|
zero if no command was executed. When \fIexit\fP is executed in a
|
||
|
\fItrap\fP action, the
|
||
|
last command is considered to be the command that executed immediately
|
||
|
preceding the \fItrap\fP action.
|
||
|
.SH CONSEQUENCES OF ERRORS
|
||
|
.LP
|
||
|
Default.
|
||
|
.LP
|
||
|
\fIThe following sections are informative.\fP
|
||
|
.SH APPLICATION USAGE
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXAMPLES
|
||
|
.LP
|
||
|
Exit with a \fItrue\fP value:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBexit 0
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
Exit with a \fIfalse\fP value:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBexit 1
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.SH RATIONALE
|
||
|
.LP
|
||
|
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:
|
||
|
.TP 7
|
||
|
\ 126
|
||
|
A file to be executed was found, but it was not an executable utility.
|
||
|
.TP 7
|
||
|
\ 127
|
||
|
A utility to be executed was not found.
|
||
|
.TP 7
|
||
|
>128
|
||
|
A command was interrupted by a signal.
|
||
|
.sp
|
||
|
.SH FUTURE DIRECTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH SEE ALSO
|
||
|
.LP
|
||
|
\fISpecial Built-In Utilities\fP
|
||
|
.SH COPYRIGHT
|
||
|
Portions of this text are reprinted and reproduced in electronic form
|
||
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
||
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
||
|
Specifications Issue 6, Copyright (C) 2001-2003 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 .
|