Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14061
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode |
| Date | 2018-04-27 16:16 -0400 |
| Message-ID | <mailman.13052.1524860223.27995.bug-bash@gnu.org> (permalink) |
| References | <a16a34cf-eea7-16b8-76d8-e05d0fe2cc32@inlv.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/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode Chet Ramey <chet.ramey@case.edu> - 2018-04-27 16:16 -0400
csiph-web