1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

ksh93/sh.1: say that ${.sh.subshell} only counts virtual subshells

${.sh.subshell} only counts the nesting level of virtual (non-forked)
subshell environments relative to the current process, whether that
is the main shell environment or a real (forked) subshell.

This means ${.sh.subshell} is not sufficient to test if your code
is running in a subshell environment, so it's important to mention
this in the manual.

E.g.:
    (echo ${.sh.subshell}; ulimit -t 1; echo ${.sh.subshell}); :
outputs 1 followed by 0.

(cherry picked from commit 63dad8863fd26bf3aa4d7a1cf60b743f4169f7c4)
This commit is contained in:
Martijn Dekker 2020-05-17 10:51:27 +01:00
parent d10eab988a
commit 9f6dd1ea73

View file

@ -1704,6 +1704,9 @@ discipline function is invoked.
.TP .TP
.B .sh.subshell .B .sh.subshell
The current depth for subshells and command substitution. The current depth for subshells and command substitution.
This value only counts the level of virtual (non-forked)
subshells and is reset to zero if and when something
requires a subshell environment to fork its own process.
.TP .TP
.B .sh.value .B .sh.value
Set to the value of the variable at the time that the Set to the value of the variable at the time that the