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

Re: [PATCHv2] [bug] $SHLVL decremented for the last command of a subshell



2016-08-30 18:00:32 +0100, Peter Stephenson:
[...]
> When this was introduced in zsh, there was some controversy over whether
> it was the right thing to do.  I decided it was on the basis that the
> "level" is how deep you are in the process hierarchy, rather than how
> many processes have previously been executed to get where you are,
> seeing as the latter isn't really visible in the current context.
> But I'm not aware of any requirement specification [remember those?]
> saying what the purpose of SHLVL is.
[...]

Yes, it's not POSIX. It was probably either a tcsh or bash
invention as both had it in 1990 and ksh88 didn't and still
doesn't have it.

And zsh behaves like tcsh and bash here (in that SHLVL is
decreased in zsh -c 'exec cmd').

-- 
Stephane



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