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-31 11:06:20 +0100, Peter Stephenson:
[...]
> I should have looked harder before committing... unfortunately, we can't
> rely on sh *not* incrementing SHLVL because it might be bash.
[...]
> - $ZTST_testdir/../Src/zsh -fc 'sh -c "echo \$SHLVL"'
[...]
> + $ZTST_testdir/../Src/zsh -fc $ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"'
[...]
Oops, sorry. That was very silly of me.
Note that it's not just bash, it's also ksh93 (as in Solaris 11
/bin/sh) or busybox sh.
Another approach could be to use "printenv" but I guess that's
not portable enough.
Note that the change also fixes the problem of SHLVL being
decremented in:
zsh -c '(exec printenv SHLVL); exit'
Which also affects bash and tcsh:
https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00000.html
http://bugs.gw.com/view.php?id=572
(trying posting via gmane, as the zsh.org mta seems to
spam-blacklist some of gmail's server IP addresses)
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author