Le 23/03/2011 20:28, Chet Ramey a écrit :
> On 3/23/11 4:15 PM, Sam Liddicott wrote:
> 
>> Yes. But a new subshell environment has been spawned. Each time that
>> happens BASH_SUBSHELL should increase.
>>
>> Of course I know how it does work, but the man page isn't clear. It doesn't
>> say that the increase is only visible within the subshell and therefore it
>> is a measurement of subshell depth.
> 
> OK.  What wording would you like to see?
> 

I would also like to see this example in the documentation:

$ ( echo sub-$BASH_SUBSHELL ); echo main-$BASH_SUBSHELL
sub-1
main-0

This example answers all doubts raised in this discussion. It also
hints at the fact that:

  ( echo 'sub-$BASH_SUBSHELL' )

does not work like an inexperienced quoter could wrongly assume.



Reply via email to