2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
2007-06-20 22:33:04 +00:00
|
|
|
.TH "RETURN" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" return
|
2007-09-20 06:03:25 +00:00
|
|
|
.SH PROLOG
|
|
|
|
This manual page is part of the POSIX Programmer's Manual.
|
|
|
|
The Linux implementation of this interface may differ (consult
|
|
|
|
the corresponding Linux manual page for details of Linux behavior),
|
|
|
|
or the interface may not be implemented on Linux.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
return \- return from a function
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.LP
|
|
|
|
\fBreturn\fP \fB[\fP\fIn\fP\fB]\fP
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.LP
|
|
|
|
The \fIreturn\fP utility shall cause the shell to stop executing the
|
|
|
|
current function or \fIdot\fP script. If the shell is not currently
|
|
|
|
executing a function or \fIdot\fP script, the results are unspecified.
|
|
|
|
.SH OPTIONS
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH OPERANDS
|
|
|
|
.LP
|
|
|
|
See the DESCRIPTION.
|
|
|
|
.SH STDIN
|
|
|
|
.LP
|
|
|
|
Not used.
|
|
|
|
.SH INPUT FILES
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH ENVIRONMENT VARIABLES
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH ASYNCHRONOUS EVENTS
|
|
|
|
.LP
|
|
|
|
Default.
|
|
|
|
.SH STDOUT
|
|
|
|
.LP
|
|
|
|
Not used.
|
|
|
|
.SH STDERR
|
|
|
|
.LP
|
|
|
|
The standard error shall be used only for diagnostic messages.
|
|
|
|
.SH OUTPUT FILES
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH EXTENDED DESCRIPTION
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH EXIT STATUS
|
|
|
|
.LP
|
|
|
|
The value of the special parameter \fB'?'\fP shall be set to \fIn\fP,
|
|
|
|
an unsigned decimal integer, or to the exit status of
|
|
|
|
the last command executed if \fIn\fP is not specified. If the value
|
|
|
|
of \fIn\fP is greater than 255, the results are undefined.
|
|
|
|
When \fIreturn\fP is executed in a \fItrap\fP action, the last command
|
|
|
|
is considered to be
|
|
|
|
the command that executed immediately preceding the \fItrap\fP action.
|
|
|
|
.SH CONSEQUENCES OF ERRORS
|
|
|
|
.LP
|
|
|
|
Default.
|
|
|
|
.LP
|
|
|
|
\fIThe following sections are informative.\fP
|
|
|
|
.SH APPLICATION USAGE
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH EXAMPLES
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH RATIONALE
|
|
|
|
.LP
|
|
|
|
The behavior of \fIreturn\fP when not in a function or \fIdot\fP script
|
|
|
|
differs between
|
|
|
|
the System V shell and the KornShell. In the System V shell this is
|
|
|
|
an error, whereas in the KornShell, the effect is the same as
|
|
|
|
\fIexit\fP.
|
|
|
|
.LP
|
|
|
|
The results of returning a number greater than 255 are undefined because
|
|
|
|
of differing practices in the various historical
|
|
|
|
implementations. Some shells AND out all but the low-order 8 bits;
|
|
|
|
others allow larger values, but not of unlimited size.
|
|
|
|
.LP
|
|
|
|
See the discussion of appropriate exit status values under \fIexit\fP
|
|
|
|
\&.
|
|
|
|
.SH FUTURE DIRECTIONS
|
|
|
|
.LP
|
|
|
|
None.
|
|
|
|
.SH SEE ALSO
|
|
|
|
.LP
|
|
|
|
\fISpecial Built-In Utilities\fP
|
|
|
|
.SH COPYRIGHT
|
|
|
|
Portions of this text are reprinted and reproduced in electronic form
|
|
|
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
|
|
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
|
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
|
|
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
|
|
|
event of any discrepancy between this version and the original IEEE and
|
|
|
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
|
|
is the referee document. The original Standard can be obtained online at
|
|
|
|
http://www.opengroup.org/unix/online.html .
|