bug-bash
[Top][All Lists]
Advanced

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

Re: IFS in function call in herestring for read


From: Chet Ramey
Subject: Re: IFS in function call in herestring for read
Date: Wed, 12 Mar 2014 14:25:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 3/12/14 12:14 PM, Evan Gates wrote:
> setup:
> foo() { printf "%q\n" "$IFS" >&2; printf "%s\n" "$*" >&2; }
> IFS=: read <<< "$(foo bar baz qux)"
> 
> bash 4.2 output:
> :
> bar:baz:qux
> 
> bash 4.3 output:
> :
> bar baz qux
> 
> 
> IFS is still set within the function call, but isn't being used in the
> expansion of "$*"

This is a cosmetic issue; the value displayed for IFS is wrong.  The
bash-4.3 behavior is correct.  It was a bug in bash-4.2 that it allowed a
value for IFS supplied as a temporary variable to affect word expansion
and redirections; those assignments should be `saved' until after
expansions are performed.

The issue was first discussed in early 2013:

http://lists.gnu.org/archive/html/bug-bash/2013-01/msg00041.html

This and other threads pointing out inconsistencies in IFS and assignments
were reported by the always-observant Dan Douglas.


Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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