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
11
13 return — return from a function or dot script
14
16 return [n]
17
19 The return utility shall cause the shell to stop executing the current
20 function or dot script. If the shell is not currently executing a func‐
21 tion or dot script, the results are unspecified.
22
24 None.
25
27 See the DESCRIPTION.
28
30 Not used.
31
33 None.
34
36 None.
37
39 Default.
40
42 Not used.
43
45 The standard error shall be used only for diagnostic messages.
46
48 None.
49
51 None.
52
54 The value of the special parameter '?' shall be set to n, an unsigned
55 decimal integer, or to the exit status of the last command executed if
56 n is not specified. If the value of n is greater than 255, the results
57 are undefined. When return is executed in a trap action, the last com‐
58 mand is considered to be the command that executed immediately preced‐
59 ing the trap action.
60
62 Default.
63
64 The following sections are informative.
65
67 None.
68
70 None.
71
73 The behavior of return when not in a function or dot script differs
74 between the System V shell and the KornShell. In the System V shell
75 this is an error, whereas in the KornShell, the effect is the same as
76 exit.
77
78 The results of returning a number greater than 255 are undefined
79 because of differing practices in the various historical implementa‐
80 tions. Some shells AND out all but the low-order 8 bits; others allow
81 larger values, but not of unlimited size.
82
83 See the discussion of appropriate exit status values under exit.
84
86 None.
87
89 Section 2.9.5, Function Definition Command, Section 2.14, Special
90 Built-In Utilities, dot
91
93 Portions of this text are reprinted and reproduced in electronic form
94 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
95 -- Portable Operating System Interface (POSIX), The Open Group Base
96 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
97 cal and Electronics Engineers, Inc and The Open Group. (This is
98 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
99 event of any discrepancy between this version and the original IEEE and
100 The Open Group Standard, the original IEEE and The Open Group Standard
101 is the referee document. The original Standard can be obtained online
102 at http://www.unix.org/online.html .
103
104 Any typographical or formatting errors that appear in this page are
105 most likely to have been introduced during the conversion of the source
106 files to man page format. To report such errors, see https://www.ker‐
107 nel.org/doc/man-pages/reporting_bugs.html .
108
109
110
111IEEE/The Open Group 2013 RETURN(1P)