1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-25 17:20:25 +02:00

39125: More care needed decrementing SHLVL on exec.

Not needed in subshell.
This commit is contained in:
Stephane Chazelas 2016-08-30 13:44:26 +01:00 committed by Peter Stephenson
parent 70166178bd
commit 8ce98c75f5
3 changed files with 30 additions and 4 deletions

View file

@ -1716,6 +1716,24 @@
$ZTST_testdir/../Src/zsh -fc '(echo $SHLVL)'
0:SHLVL appears sensible when about to exit shell
>2
>2
SHLVL=1
$ZTST_testdir/../Src/zsh -fc 'sh -c "echo \$SHLVL"'
$ZTST_testdir/../Src/zsh -fc '(sh -c "echo \$SHLVL")'
$ZTST_testdir/../Src/zsh -fc '( (sh -c "echo \$SHLVL"))'
0:SHLVL decremented upon implicit exec optimisation
>1
>1
>1
SHLVL=1
$ZTST_testdir/../Src/zsh -fc '(sh -c "echo \$SHLVL"); exit'
$ZTST_testdir/../Src/zsh -fc '(exec sh -c "echo \$SHLVL"); exit'
$ZTST_testdir/../Src/zsh -fc '( (sh -c "echo \$SHLVL"); exit)'
0:SHLVL not decremented upon exec in subshells
>2
>2
>2
# The following tests the return behaviour of parsestr/parsestrnoerr