1RETURN(1P) POSIX Programmer's Manual RETURN(1P)
2
3
4
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
12 return — return from a function or dot script
13
15 return [n]
16
18 The return utility shall cause the shell to stop executing the current
19 function or dot script. If the shell is not currently executing a func‐
20 tion or dot script, the results are unspecified.
21
23 None.
24
26 See the DESCRIPTION.
27
29 Not used.
30
32 None.
33
35 None.
36
38 Default.
39
41 Not used.
42
44 The standard error shall be used only for diagnostic messages.
45
47 None.
48
50 None.
51
53 The value of the special parameter '?' shall be set to n, an unsigned
54 decimal integer, or to the exit status of the last command executed if
55 n is not specified. If n is not an unsigned decimal integer, or is
56 greater than 255, the results are unspecified. When return is executed
57 in a trap action, the last command is considered to be the command that
58 executed immediately preceding the trap action.
59
61 Default.
62
63 The following sections are informative.
64
66 None.
67
69 None.
70
72 The behavior of return when not in a function or dot script differs
73 between the System V shell and the KornShell. In the System V shell
74 this is an error, whereas in the KornShell, the effect is the same as
75 exit.
76
77 The results of returning a number greater than 255 are undefined
78 because of differing practices in the various historical implementa‐
79 tions. Some shells AND out all but the low-order 8 bits; others allow
80 larger values, but not of unlimited size.
81
82 See the discussion of appropriate exit status values under exit.
83
85 None.
86
88 Section 2.9.5, Function Definition Command, Section 2.14, Special
89 Built-In Utilities, dot
90
92 Portions of this text are reprinted and reproduced in electronic form
93 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
94 table Operating System Interface (POSIX), The Open Group Base Specifi‐
95 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
96 Electrical and Electronics Engineers, Inc and The Open Group. In the
97 event of any discrepancy between this version and the original IEEE and
98 The Open Group Standard, the original IEEE and The Open Group Standard
99 is the referee document. The original Standard can be obtained online
100 at http://www.opengroup.org/unix/online.html .
101
102 Any typographical or formatting errors that appear in this page are
103 most likely to have been introduced during the conversion of the source
104 files to man page format. To report such errors, see https://www.ker‐
105 nel.org/doc/man-pages/reporting_bugs.html .
106
107
108
109IEEE/The Open Group 2017 RETURN(1P)