summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2017/man1p/exit.1p
diff options
context:
space:
mode:
Diffstat (limited to 'man-pages-posix-2017/man1p/exit.1p')
-rw-r--r--man-pages-posix-2017/man1p/exit.1p167
1 files changed, 167 insertions, 0 deletions
diff --git a/man-pages-posix-2017/man1p/exit.1p b/man-pages-posix-2017/man1p/exit.1p
new file mode 100644
index 0000000..d8d05cc
--- /dev/null
+++ b/man-pages-posix-2017/man1p/exit.1p
@@ -0,0 +1,167 @@
+'\" et
+.TH EXIT "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\"
+.SH PROLOG
+This manual page is part of the POSIX Programmer's 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.
+.\"
+.SH NAME
+exit
+\(em cause the shell to exit
+.SH SYNOPSIS
+.LP
+.nf
+exit \fB[\fIn\fB]\fR
+.fi
+.SH DESCRIPTION
+The
+.IR exit
+utility shall cause the shell to exit from its current execution
+environment with the exit status specified by the unsigned decimal integer
+.IR n .
+If the current execution environment is a subshell environment, the
+shell shall exit from the subshell environment with the specified exit
+status and continue in the environment from which that subshell
+environment was invoked; otherwise, the shell utility shall terminate
+with the specified exit status. If
+.IR n
+is specified, but its value is not between 0 and 255 inclusively, the
+exit status is undefined.
+.P
+A
+.IR trap
+on
+.BR EXIT
+shall be executed before the shell terminates, except when the
+.IR exit
+utility is invoked in that
+.IR trap
+itself, in which case the shell shall exit immediately.
+.SH OPTIONS
+None.
+.SH OPERANDS
+See the DESCRIPTION.
+.SH STDIN
+Not used.
+.SH "INPUT FILES"
+None.
+.SH "ENVIRONMENT VARIABLES"
+None.
+.SH "ASYNCHRONOUS EVENTS"
+Default.
+.SH STDOUT
+Not used.
+.SH STDERR
+The standard error shall be used only for diagnostic messages.
+.SH "OUTPUT FILES"
+None.
+.SH "EXTENDED DESCRIPTION"
+None.
+.SH "EXIT STATUS"
+The exit status shall be
+.IR n ,
+if specified, except that the behavior is unspecified if
+.IR n
+is not an unsigned decimal integer or is greater than 255. Otherwise,
+the value shall be the exit value of the last command executed, or
+zero if no command was executed. When
+.IR exit
+is executed in a
+.IR trap
+action, the last command is considered to be the command that executed
+immediately preceding the
+.IR trap
+action.
+.SH "CONSEQUENCES OF ERRORS"
+Default.
+.LP
+.IR "The following sections are informative."
+.SH "APPLICATION USAGE"
+None.
+.SH EXAMPLES
+Exit with a
+.IR true
+value:
+.sp
+.RS 4
+.nf
+
+exit 0
+.fi
+.P
+.RE
+.P
+Exit with a
+.IR false
+value:
+.sp
+.RS 4
+.nf
+
+exit 1
+.fi
+.P
+.RE
+.P
+Propagate error handling from within a subshell:
+.sp
+.RS 4
+.nf
+
+(
+ command1 || exit 1
+ command2 || exit 1
+ exec command3
+) > outputfile || exit 1
+echo "outputfile created successfully"
+.fi
+.P
+.RE
+.SH "RATIONALE"
+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:
+.IP "\0126" 8
+A file to be executed was found, but it was not an executable utility.
+.IP "\0127" 8
+A utility to be executed was not found.
+.IP >128 8
+A command was interrupted by a signal.
+.P
+The behavior of
+.IR exit
+when given an invalid argument or unknown option is unspecified,
+because of differing practices in the various historical
+implementations. A value larger than 255 might be truncated by the
+shell, and be unavailable even to a parent process that uses
+\fIwaitid\fR()
+to get the full exit value. It is recommended that implementations
+that detect any usage error should cause a non-zero exit status (or,
+if the shell is interactive and the error does not cause the shell to
+abort, store a non-zero value in
+.BR \(dq$?\(dq ),
+but even this was not done historically in all shells.
+.SH "FUTURE DIRECTIONS"
+None.
+.SH "SEE ALSO"
+.IR "Section 2.14" ", " "Special Built-In Utilities"
+.\"
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1-2017, Standard for Information Technology
+-- 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 .
+.PP
+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 .