RETURN(1P)
๐ RETURN(1P) โ the POSIX Programmer's Manual glow-up ๐
okay bestie, buckle up, we're doing return(1P) from the POSIX Programmer's Manual โจ
๐ธ PROLOG ๐ธ
okay so real talk first: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the tea on Linux behavior, iykyk), or honestly the interface may not be implemented on Linux at all. ๐
๐ NAME ๐
return โ return from a function or dot script
โจ SYNOPSIS โจ
return [n]
๐ DESCRIPTION ๐
The return utility shall cause the shell to stop executing the current function or dot script. That's it, that's the whole vibe. ๐
But listen โ if the shell is not currently executing a function or dot script, the results are unspecified. No cap. So don't come crying to me when it does something feral. ๐ญ
๐ฆ OPTIONS ๐ฆ
None. Not a single one. She's minimal, she's clean, she's iconic. โจ
๐ OPERANDS ๐
See the DESCRIPTION. (Yeah I know, they just pointed at the other section. Rude but valid. ๐)
๐ STDIN ๐
Not used. She does not read. She is not taking input today. ๐ โโ๏ธ
๐ง INPUT FILES ๐ง
None. Zero. Nada. ๐
๐ ENVIRONMENT VARIABLES ๐
None. She does not care about your environment, bestie. She's above it. ๐
โญ ASYNCHRONOUS EVENTS โญ
Default. โจ
๐ธ STDOUT ๐ธ
Not used. She's not printing anything, she's leaving. ๐
๐ STDERR ๐
The standard error shall be used only for diagnostic messages. So if something shows up there, it's a warning, not a vibe. ๐ซถ
๐ OUTPUT FILES ๐
None. ๐ฆ
๐ฅ EXTENDED DESCRIPTION ๐ฅ
None. (The extended description is giving "no thoughts, head empty" and honestly? respect.) โจ
๐ EXIT STATUS ๐
okay this is the part that actually matters so pay attention bestie:
- The value of the special parameter
'?'shall be set ton, an unsigned decimal integer โ or to the exit status of the last command executed ifnis not specified. - If
nis not an unsigned decimal integer, or is greater than 255, the results are unspecified. ๐จ like, undefined. chaos. do not do this. - When
returnis executed in a trap action, the last command is considered to be the command that executed immediately preceding the trap action. (yes, that's the exact rule, write it down ๐)
๐ CONSEQUENCES OF ERRORS ๐
Default. โจ
The following sections are informative. (so like, they're the lore, not the law ๐)
๐ APPLICATION USAGE ๐
None. Nothing to add, she said what she said. ๐
๐ EXAMPLES ๐
None. The examples section is empty and honestly it's giving mysterious main character energy. ๐
๐ง RATIONALE ๐ง
okay so the drama:
The behavior of return when 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. So like... two shells, two completely different personalities. ๐ญ
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. (yes, "AND" is literally the word they used, it's bitwise AND, we love a retro moment ๐)
See the discussion of appropriate exit status values under exit. ๐
๐ฎ FUTURE DIRECTIONS ๐ฎ
None. The future is hers and she's not changing a thing. ๐
๐ 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 .
fr fr, that's the whole page. every flag (there are none ๐), every operand, every status, every warning โ all accounted for. no details were harmed in the making of this glow-up. ๐ซถ
and that's a wrap, bestie โ this one came to you courtesy of IEEE/The Open Group, 2017, on the RETURN(1P) page. slay, bye ๐ โจ๐๐ฆ๐
๐ฆ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 ยท custom
- alpine 3.23: man-pages-posix 2017a-r0 ยท custom
- alpine 3.24: man-pages-posix 2017a-r0 ยท custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 ยท SUSE-IEEE
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms