Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14078 > unrolled thread
| Started by | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| First post | 2018-05-01 21:20 -0400 |
| Last post | 2018-05-01 21:20 -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.
Re: [BUG] 'unset' fails silently under specific conditions Chet Ramey <chet.ramey@case.edu> - 2018-05-01 21:20 -0400
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2018-05-01 21:20 -0400 |
| Subject | Re: [BUG] 'unset' fails silently under specific conditions |
| Message-ID | <mailman.13236.1525224063.27995.bug-bash@gnu.org> |
On 5/1/18 6:27 PM, Martijn Dekker wrote: > Op 01-05-18 om 19:36 schreef Chet Ramey: >> OK, so which is it? Does an assignment statement preceding a special >> builtin in a shell function create a local variable (as we discussed >> just yesterday) > > Huh? That was about 'typeset'/'declare'. How is that relevant here? Do you really not remember? Let's roll tape. You complained that `typeset +x' didn't `unexport' a variable. The reason is that the variable assignment preceding the special builtin caused a variable to be created at the global scope, and the `typeset' resulted in a local variable being created. The upshot of that discussion was that in order to implement the semantics you said you wanted at the time, > >> or does it create a global variable because `Posix'? > > Yes. POSIX does not specify local variables at all, and even in a bash > context I see nothing there to indicate that it should be local. Maybe in Posix mode. It's true that Posix doesn't specify local variables, and I made that same point yesterday, but I can see where an assignment statement preceding a special builtin can create a variable at the same context. > The possibility that 'foo=bar :' might create a variable 'foo' that > survives the ':' command, is exported, *and* is local to the function, > hadn't occurred to me at all. POSIX is pretty strange sometimes but not > *this* strange. It would have had to to satisfy the semantics of your report from a couple of days ago, and, as I said in my message yesterday, I ultimately implemented those semantics. -- ``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 top | Article view | gnu.bash.bug
csiph-web