Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9
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.