[Top][All Lists]

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

Re: [BUG] persistently assigned variable cannot be unexported in POSIX m

From: Chet Ramey
Subject: Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode
Date: Fri, 27 Apr 2018 16:16:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 4/25/18 10:51 PM, Martijn Dekker wrote:

> What I'm reporting here is a bug I discovered with unexporting a variable
> that is so exported while bash is in POSIX mode. It cannot be unexported
> using 'typeset +x' if you try to do that in a shell function.
> This works:
> $ bash -o posix -c 'foo=abc : ; typeset +x foo; env|grep ^foo='
> (no output, as expected: no longer exported)
> But this doesn't:
> $ bash -o posix -c 'fn() { foo=abc : ; typeset +x foo; env|grep ^foo=; }; fn'
> foo=abc

It seems like you're assuming that in posix mode, variable assignments that
precede special builtins executed in shell functions should create local
variables. Is that correct? Even though Posix doesn't define local
variables and only `declare' and its synonyms can create them?


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

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