1EXIT(1P)                   POSIX Programmer's Manual                  EXIT(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       exit — cause the shell to exit
14

SYNOPSIS

16       exit [n]
17

DESCRIPTION

19       The exit utility shall cause the shell to exit  with  the  exit  status
20       specified  by  the  unsigned decimal integer n.  If n is specified, but
21       its value is not between 0 and 255  inclusively,  the  exit  status  is
22       undefined.
23
24       A  trap  on  EXIT shall be executed before the shell terminates, except
25       when the exit utility is invoked in that trap itself, in which case the
26       shell shall exit immediately.
27

OPTIONS

29       None.
30

OPERANDS

32       See the DESCRIPTION.
33

STDIN

35       Not used.
36

INPUT FILES

38       None.
39

ENVIRONMENT VARIABLES

41       None.
42

ASYNCHRONOUS EVENTS

44       Default.
45

STDOUT

47       Not used.
48

STDERR

50       The standard error shall be used only for diagnostic messages.
51

OUTPUT FILES

53       None.
54

EXTENDED DESCRIPTION

56       None.
57

EXIT STATUS

59       The exit status shall be n, if specified. Otherwise, the value shall be
60       the exit value of the last command executed, or zero if no command  was
61       executed.  When  exit is executed in a trap action, the last command is
62       considered to be the command that executed  immediately  preceding  the
63       trap action.
64

CONSEQUENCES OF ERRORS

66       Default.
67
68       The following sections are informative.
69

APPLICATION USAGE

71       None.
72

EXAMPLES

74       Exit with a true value:
75
76           exit 0
77
78       Exit with a false value:
79
80           exit 1
81

RATIONALE

83       As  explained  in  other sections, certain exit status values have been
84       reserved for special uses and should be used by applications  only  for
85       those purposes:
86
87        126    A  file  to be executed was found, but it was not an executable
88               utility.
89
90        127    A utility to be executed was not found.
91
92       >128    A command was interrupted by a signal.
93

FUTURE DIRECTIONS

95       None.
96

SEE ALSO

98       Section 2.14, Special Built-In Utilities
99
101       Portions of this text are reprinted and reproduced in  electronic  form
102       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
103       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
104       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
105       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
106       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
107       event of any discrepancy between this version and the original IEEE and
108       The  Open Group Standard, the original IEEE and The Open Group Standard
109       is the referee document. The original Standard can be  obtained  online
110       at http://www.unix.org/online.html .
111
112       Any  typographical  or  formatting  errors that appear in this page are
113       most likely to have been introduced during the conversion of the source
114       files  to  man page format. To report such errors, see https://www.ker
115       nel.org/doc/man-pages/reporting_bugs.html .
116
117
118
119IEEE/The Open Group                  2013                             EXIT(1P)
Impressum