Re: read builtin. input processes improperly inheriting IFS setting

2013-07-27 Thread Chet Ramey
On 7/26/13 12:34 PM, David H. wrote: > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > > When the read builtin is prefixed by an IFS setting, for field > splitting, and the input involves an unquoted variable expanded inside > a herestring, command substituti

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Andreas Schwab
Greg Wooledge writes: > Do you mean variable expansions? No, I mean what I write. > Here's the code in question, simplified even further: > > imadev:~$ unset IFS > imadev:~$ foo=a/b/c > imadev:~$ cat < <(echo $foo) > a/b/c > imadev:~$ IFS=/ cat < <(echo $foo) > a b c > > Clearly the IFS assignm

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Greg Wooledge
On Fri, Jul 26, 2013 at 10:38:46PM +0200, Andreas Schwab wrote: > Greg Wooledge writes: > > > Your unquoted $instring is being split into fields by bash, which is > > operating with IFS=: at that point. > > Variable assignments are supposed to be performed _after_ redirections > (read is not a s

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Andreas Schwab
Greg Wooledge writes: > Your unquoted $instring is being split into fields by bash, which is > operating with IFS=: at that point. Variable assignments are supposed to be performed _after_ redirections (read is not a special built-in). Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Greg Wooledge
On Sat, Jul 27, 2013 at 01:34:53AM +0900, David H. wrote: > # The test string: > $ echo $instring > root:x:0:0:root:/root:/bin/bash > > # Gives incorrect (unexpected) output: > $ ( IFS=: read -a strings < <( echo $instring ) ; printf '[%s]\n' > "${strings[@]}" ) > [root x 0