Package: bash
Version: 4.2+dfsg-1
Severity: minor
Tags: upstream

As reported in 
http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00176.html, the manpage's 
documentation of BASH_SUBLEVEL (which indicates a subshell's depth) is 
misleading:
BASH_SUBSHELL
Incremented by one each time a subshell or subshell environment
               is spawned.  The initial value is 0.

In fact, the value is only incremented in the subshell. The 4.3 version fixes 
this:

BASH_SUBSHELL
 Incremented by one within each subshell or subshell environment when the shell 
begins executing in that environment. The initial value is 0.

The SHLVL variable (which indicates the actual shell's depth relative to its 
root bash process) has the same issue:
SHLVL
 Incremented by one each time an instance of bash  is started.

The incrementation only happens in the child shell.

The latter issue persists in 4.3. In both cases, it would be more useful and 
less complicated to specify what the variables contain rather than trying to 
describe how they are computed.

--
Filipus Klutiero
http://www.philippecloutier.com


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to