Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14061 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2018-04-27 16:16 -0400
Last post2018-04-27 16:16 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode Chet Ramey <chet.ramey@case.edu> - 2018-04-27 16:16 -0400

#14061 — Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode

FromChet Ramey <chet.ramey@case.edu>
Date2018-04-27 16:16 -0400
SubjectRe: [BUG] persistently assigned variable cannot be unexported in POSIX mode
Message-ID<mailman.13052.1524860223.27995.bug-bash@gnu.org>
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    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web