From: Name withheld by request on
Not what I would expect:

/tmp $ echo a=Y > foo
/tmp $ a=X;source foo; echo $a
Y
/tmp $ a=X; source <( echo a=Y ) ; echo $a
X
/tmp $ echo $BASH_VERSION
3.2.49(23)-release

What is it I'm missing, why isn't this a bug?

--
thanks


/tmp $ command od -Ad -c < <( echo a=Y )
0000000 a = Y \n
0000004

From: pk on
Name withheld by request wrote:

> Not what I would expect:
>
> /tmp $ echo a=Y > foo
> /tmp $ a=X;source foo; echo $a
> Y
> /tmp $ a=X; source <( echo a=Y ) ; echo $a
> X
> /tmp $ echo $BASH_VERSION
> 3.2.49(23)-release
>
> What is it I'm missing, why isn't this a bug?

It works as expected for me with bash 4.0.35:

$ bash --version
GNU bash, version 4.0.35(2)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ a=X; source <(echo a=Y); echo "$a"
Y
From: Chris F.A. Johnson on
On 2010-01-30, pk wrote:
> Name withheld by request wrote:
>
>> Not what I would expect:
>>
>> /tmp $ echo a=Y > foo
>> /tmp $ a=X;source foo; echo $a
>> Y
>> /tmp $ a=X; source <( echo a=Y ) ; echo $a
>> X
>> /tmp $ echo $BASH_VERSION
>> 3.2.49(23)-release
>>
>> What is it I'm missing, why isn't this a bug?
>
> It works as expected for me with bash 4.0.35:

Yes, it works in bash 4+, but not in 3.X; the OP should upgrade.

--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
===== My code in this post, if any, assumes the POSIX locale =====
===== and is released under the GNU General Public Licence =====
From: Name withheld by request on
Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
--snip
> Yes, it works in bash 4+, but not in 3.X; the OP should upgrade.

Thanks to you both. I'll look forward to the upgrade.

Did not know bash 4+ existed.. :->

http://tiswww.case.edu/php/chet/bash/NEWS

>--
> Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
> ===================================================================
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
> ===== My code in this post, if any, assumes the POSIX locale =====
> ===== and is released under the GNU General Public Licence =====