1RETURN(P) POSIX Programmer's Manual RETURN(P)
2
3
4
6 return - return from a function
7
9 return [n]
10
12 The return utility shall cause the shell to stop executing the current
13 function or dot script. If the shell is not currently executing a func‐
14 tion or dot script, the results are unspecified.
15
17 None.
18
20 See the DESCRIPTION.
21
23 Not used.
24
26 None.
27
29 None.
30
32 Default.
33
35 Not used.
36
38 The standard error shall be used only for diagnostic messages.
39
41 None.
42
44 None.
45
47 The value of the special parameter '?' shall be set to n, an unsigned
48 decimal integer, or to the exit status of the last command executed if
49 n is not specified. If the value of n is greater than 255, the results
50 are undefined. When return is executed in a trap action, the last com‐
51 mand is considered to be the command that executed immediately preced‐
52 ing the trap action.
53
55 Default.
56
57 The following sections are informative.
58
60 None.
61
63 None.
64
66 The behavior of return when not in a function or dot script differs
67 between the System V shell and the KornShell. In the System V shell
68 this is an error, whereas in the KornShell, the effect is the same as
69 exit.
70
71 The results of returning a number greater than 255 are undefined
72 because of differing practices in the various historical implementa‐
73 tions. Some shells AND out all but the low-order 8 bits; others allow
74 larger values, but not of unlimited size.
75
76 See the discussion of appropriate exit status values under exit .
77
79 None.
80
82 Special Built-In Utilities
83
85 Portions of this text are reprinted and reproduced in electronic form
86 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
87 -- Portable Operating System Interface (POSIX), The Open Group Base
88 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
89 Electrical and Electronics Engineers, Inc and The Open Group. In the
90 event of any discrepancy between this version and the original IEEE and
91 The Open Group Standard, the original IEEE and The Open Group Standard
92 is the referee document. The original Standard can be obtained online
93 at http://www.opengroup.org/unix/online.html .
94
95
96
97IEEE/The Open Group 2003 RETURN(P)