1RETURN(1P)                 POSIX Programmer's Manual                RETURN(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

NAME

12       return - return from a function
13

SYNOPSIS

15       return [n]
16

DESCRIPTION

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

OPTIONS

23       None.
24

OPERANDS

26       See the DESCRIPTION.
27

STDIN

29       Not used.
30

INPUT FILES

32       None.
33

ENVIRONMENT VARIABLES

35       None.
36

ASYNCHRONOUS EVENTS

38       Default.
39

STDOUT

41       Not used.
42

STDERR

44       The standard error shall be used only for diagnostic messages.
45

OUTPUT FILES

47       None.
48

EXTENDED DESCRIPTION

50       None.
51

EXIT STATUS

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 the value of n is greater than 255, the  results
56       are undefined.  When return is executed in a trap action, the last com‐
57       mand is considered to be the command that executed immediately  preced‐
58       ing the trap action.
59

CONSEQUENCES OF ERRORS

61       Default.
62
63       The following sections are informative.
64

APPLICATION USAGE

66       None.
67

EXAMPLES

69       None.
70

RATIONALE

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

FUTURE DIRECTIONS

85       None.
86

SEE ALSO

88       Special Built-In Utilities
89
91       Portions  of  this text are reprinted and reproduced in electronic form
92       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
93       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
94       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
95       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
96       event of any discrepancy between this version and the original IEEE and
97       The  Open Group Standard, the original IEEE and The Open Group Standard
98       is the referee document. The original Standard can be  obtained  online
99       at http://www.opengroup.org/unix/online.html .
100
101
102
103IEEE/The Open Group                  2003                           RETURN(1P)
Impressum