[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Short list of issues with various expansions and IFS
From: |
Chet Ramey |
Subject: |
Re: Short list of issues with various expansions and IFS |
Date: |
Wed, 30 Jan 2013 10:53:27 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
On 1/30/13 12:16 AM, Dan Douglas wrote:
>>> 3. Another IFS oddity via "command"
>>>
>>> IFS can be given "two values at once" through the environment of a
>>> redirection.
>>
>> I have to look at this one. It's clear that the temporary environment
>> given to `command' is like the temp environment supplied to `eval', and
>> needs to persist through all of the commands executed by `command'. I
>> have to figure out whether that temporary environment counts as the temp
>> environment to `cat' (I don't think so) and how to reconcile the variable
>> lookups during redirection expansion.
>
> I think at least the variable should be accessible to builtins or functions
> run by `command' (if not cat). Maybe you meant it doesn't actually get
> exported to non-builtins? In this case, the redirect should be applying to
> the
> `command' command, so the outer environment is what applies to the redirect
> just like any other normal command (I think).
It's all good. The problem was that bash was using stale cached
information about IFS -- it was updated when the variable was assigned in
the temp environment, but not invalidated when doing redirections, since
redirections don't have access to the temp environment.
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/