Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "return" behaves differently in .zlogout (Was: Subshell return codes are discarded during logout?)



On Fri, Dec 27, 2024 at 12:03 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
On Fri, Dec 27, 2024, at 2:23 PM, Bart Schaefer wrote:
> That is, "return" does not clobber the exit status specified for the
> top-level shell, whereas a subsequent explicit "exit" does so.

Ah, it permits quitting .zlogout early without having to juggle the
original $?.  I can see why that's useful, but I had no idea it was
an option because it doesn't seem to be documented.

Could be worth explicit documentation, but it's implicit in that return exits from a script by setting the return value of the script without terminating the calling shell.  The rest of the logout procedure then continues.


Messages sorted by: Reverse Date, Date, Thread, Author