RETURN(1POSIX)
π«Ά RETURN(1POSIX) π«Ά
okay bestie, so this page is from the POSIX Programmer's Manual β you know, the whole POSIX Programmer's Manual vibe. π But real talk: the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the actual deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. π Just saying.
β¨ NAME β¨
return β bestie, it returns from a function or a dot script. that's it. that's the whole job. π
πΈ SYNOPSIS πΈ
return [n]
π DESCRIPTION π
The return utility shall cause the shell to stop executing the current function or dot script. periodt. π
not me dropping the lore though: if the shell is not currently executing a function or dot script, the results are unspecified. so like, don't. π
π OPTIONS π
None. literally none. nothing to see here. π
π¦ OPERANDS π¦
See the DESCRIPTION. it's giving "scroll up bestie" β¨
π STDIN π
Not used. she's not listening. π
π INPUT FILES π
None.
π§ ENVIRONMENT VARIABLES π§
None.
β ASYNCHRONOUS EVENTS β
Default.
πΈ STDOUT πΈ
Not used. she doesn't talk back. π
π STDERR π
The standard error shall be used only for diagnostic messages. so if she's yelling at you, it's a legit complaint. π
π₯ OUTPUT FILES π₯
None.
π EXTENDED DESCRIPTION π
None.
β¨ EXIT STATUS β¨
okay this is the part that actually matters, so listen up. π
The value of the special parameter ? shall be set to n, an unsigned decimal integer, or to the exit status of the last command executed if n is not specified.
and if n is not an unsigned decimal integer, or is greater than 255, the results are unspecified. no cap. don't do it. π
When return is executed in a trap action, the last command is considered to be the command that executed immediately preceding the trap action. iykyk.
π«Ά CONSEQUENCES OF ERRORS π«Ά
Default.
The following sections are informative. (translation: this is the bonus content, not the rules β¨)
π APPLICATION USAGE π
None.
π EXAMPLES π
None. sorry bestie, no demo today. π
π RATIONALE π
so the tea is: the behavior of return when you're not in a function or dot 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 exit. different strokes, different shells. π
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. it's giving chaos. π
See the discussion of appropriate exit status values under exit.
π§ FUTURE DIRECTIONS π§
None. she's not going anywhere. π¦
β SEE ALSO β
- Section 2.9.5, Function Definition Command
- Section 2.14, Special Built-In Utilities
dot
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 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 .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie! ππβ¨ this icon of a manual page came to you from IEEE/The Open Group, dated 2017, and it lives under the name RETURN(1POSIX). go forth and return responsibly. mwah. π
π¦
π¦ where this page comes from
- debian bookworm: manpages-posix 2017a-2 Β· Other
- debian trixie: manpages-posix 2017a-2 Β· Other
- ubuntu jammy: manpages-posix 2017a-2 Β· Other
- ubuntu noble: manpages-posix 2017a-2 Β· Other
- ubuntu resolute: manpages-posix 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms