From 9f6dd1ea73f61aeb06f18b5b03a668273dcbf507 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sun, 17 May 2020 10:51:27 +0100 Subject: [PATCH] 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) --- src/cmd/ksh93/sh.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 3aadca961..b663c17e4 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -1704,6 +1704,9 @@ discipline function is invoked. .TP .B .sh.subshell 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 .B .sh.value Set to the value of the variable at the time that the