Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15951
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: test -v for array does not work as documented |
| Date | 2020-02-23 11:27 -0500 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.1445.1582474983.2412.bug-bash@gnu.org> (permalink) |
| References | <mailman.4206.1582208094.2410.bug-bash@gnu.org> <w6gh7zlz4de.fsf@kph.uni-mainz.de> <a07dd152-b50a-a77b-13c1-fc559b053fdd@case.edu> <25b3fccb-151b-0712-76f1-5b19ffcce1d9@passchier.net> <9a084bb5-2362-b140-f3e8-9e18a0f1cac6@case.edu> |
On 2/21/20 3:31 AM, pepa65 wrote: > On 21/02/2020 02.37, Chet Ramey wrote: >> It's unset because it doesn't have a value, but it retains the `local' >> attribute so it stays local if subsequently assigned one. > > Is there any reason the local attribute cannot be unset? If it would be > possible then the "declare/typeset -p" would return 1 when the variable > doesn't exist. There have been several umm...passionate discussions about this. The idea is that a local variable that's unset should stay local (and unset) until the function returns instead of `uncovering' a variable at a previous scope. Think about dynamic scoping and its effects on variable visibility. > By the way, it seems that `local -p var` doesn't work like 'declare -p > var` even though `help local` suggests it should. How so? Do you mean that declare -p var in a function will show different variables? -- ``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
Re: test -v for array does not work as documented Chet Ramey <chet.ramey@case.edu> - 2020-02-23 11:27 -0500
csiph-web