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


Groups > gnu.bash.bug > #14081

Re: [BUG] 'unset' fails silently under specific conditions

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: [BUG] 'unset' fails silently under specific conditions
Date 2018-05-02 10:38 -0400
Message-ID <mailman.13279.1525271918.27995.bug-bash@gnu.org> (permalink)
References (3 earlier) <71d753dc-036f-7fd7-d703-408c3f8ac202@case.edu> <48f7a2c2-70ce-0994-33e0-6b2282a3b5f6@inlv.org> <aa36f1ca-ca58-ebee-4f95-2e76e5221721@case.edu> <d87ee315-f35d-67e5-32a7-44d40110b5fd@inlv.org> <20180502143252.gie2em6535qbrlfu@eeg.ccf.org>

Show all headers | View raw


On Wed, May 02, 2018 at 10:32:52AM -0400, Greg Wooledge wrote:
> wooledg:~$ bash
> wooledg:~$ set -o posix
> wooledg:~$ f() { foo=bar; foo=baz : ; }; f
> wooledg:~$ declare -p foo
> declare -x foo="baz"
> 
> What did you see that led you to conclude there is a local variable
> involved?  (Not counting discussions with Chet!)

After sending that, I saw the Subject: header, and figured maybe you
left something out in your example.  Trying again, this time with an
unset command in the mix:

wooledg:~$ bash
wooledg:~$ set -o posix
wooledg:~$ f() { foo=bar; declare -p foo; foo=baz :; declare -p foo; unset foo; declare -p foo; }; f
declare -- foo="bar"
declare -x foo="baz"
declare -- foo="bar"
wooledg:~$ declare -p foo
declare -- foo="bar"
wooledg:~$ env | grep foo=
wooledg:~$ 

*NOW* there's evidence of a local variable, because unset removes it
and exposes the global.  But it's not "permanently exported" as far as
I can see.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: [BUG] 'unset' fails silently under specific conditions Greg Wooledge <wooledg@eeg.ccf.org> - 2018-05-02 10:38 -0400

csiph-web