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?

Chet

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

Reply via email to