bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'local -x VARIABLE' does not clear variable for subprocesses


From: Dan Douglas
Subject: Re: 'local -x VARIABLE' does not clear variable for subprocesses
Date: Wed, 07 May 2014 10:43:17 -0500
User-agent: KMail/4.13 (Linux/3.14.0-pf1+; KDE/4.13.0; x86_64; ; )

On Wednesday, May 07, 2014 10:04:11 AM Chet Ramey wrote:
> On 5/7/14, 2:10 AM, Dan Douglas wrote:
> > By "doesn't shadow" you mean that it _does_ hide the global right? 
> > Localizing
> > a variable should cover up globals and variables in parent scopes even if 
> > they
> > aren't given a value. That seems true in bash 4.3 and nearly every shell
> > (except dash).
>
> I mean that a local variable that has not been given a value, and is
> technically unset, should not shadow a global variable with the same
> name.  Run the following script, after accounting for the local/typeset
> differences between shells.  The results are less conclusive than you think.

Ah ok I thought you meant the opposite. So not the "dash effect" where
the value of a global is always still visible until a local gets a
value.

Yes I see the results are all over the place. Basically what the big
script linked in my previous post attempted to test, though ksh lexical
scope makes comparison hard and not so meaningful. Your bash 4.3 way
makes sense to me (leaving the global in the environment but shadowing
the local).

--
Dan Douglas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]