bug-bash
[Top][All Lists]
Advanced

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

Re: How to do? Possible?


From: Davide Brini
Subject: Re: How to do? Possible?
Date: Mon, 25 Jul 2011 23:59:54 +0200
User-agent:

On Mon, 25 Jul 2011 14:28:52 -0700, Linda Walsh <bash@tlinx.org> wrote:

>   Not really.
>   It only seems that way because within () any "$xxxx" is usually
> expanded BEFORE the () starts from the parent....
> 
>   You can see this by
>   GLOBAL="hi there"
>   (echo $GLOBAL)
> prints out "hi there" as expected, but if we hide
> $GLOBAL so it isn't seen by parent:
> (foo=GLOBAL; echo ${!foo})
> prints ""
> 
> So, they aren't really available in a subshell, only
> that a subshell's contents are evaluated before the subshell is
> called.

There is a distinction to make between exported and non-exported variables.
Also, 

foo=bar command

is quite different from

foo=bar; command

(although sometimes, under certain conditions, they may appear to yield the
same result).

-- 
D.



reply via email to

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