bug-bash
[Top][All Lists]
Advanced

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

Re: IGNOREEOF and POSIXLY_CORRECT don't ignore invisible vars


From: Chet Ramey
Subject: Re: IGNOREEOF and POSIXLY_CORRECT don't ignore invisible vars
Date: Mon, 20 Jun 2016 15:46:51 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 6/18/16 7:59 PM, Linda Walsh wrote:

> Grisha Levit wrote:
>> The manual references these values being set, not just declared, so maybe
>> should check for invisible_p?
> ---
> Why?  I.e. what were you wanting to happen?

Think it through.  A variable is not set until it has been assigned a
value.  Giving a variable an attribute (in this case, the `local'
attribute) without assigning a value means that the variable is still
unset.  For example,

export X
echo ${X:+set}
printenv X

will display nothing.  So the two examples Grisha gave print the same
thing, though the documentation says that POSIXLY_CORRECT and IGNOREEOF
have an effect only when set (though IGNOREEOF is more vague, and talks
about `no value', by which it means the null string).

Grisha's question is whether or not the variables need to be set before
having side effects.  I tend to agree with him.

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]