Groups | Search | Server Info | Login | Register
Groups > gnu.bash.bug > #16875
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Incorrect / Inconsistent behavior with nameref assignments in functions |
| Date | 2020-08-31 11:23 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.1871.1598887444.2469.bug-bash@gnu.org> (permalink) |
| References | <a20e4692-69b3-9836-4861-3e822e407ef7@binarus.de> <20200828152846.GI931@eeg.ccf.org> <2868cd77-7832-e4f7-57d2-f75a37344d85@case.edu> |
On 8/28/20 11:28 AM, Greg Wooledge wrote: > > You've got a local variable with the same name as the global variable > that you're attempting to pass by reference. This will not work. > > Namerefs (declare -n) in bash are *not* like uplevel commands in Tcl. > They cause the referenced variable name to be evaluated just like any > other variable would be, starting at the current function scope, then > going up to the caller, and so on. Namerefs don't change bash's dynamic variable scoping. The two conflict and make namerefs less useful than they might be. -- ``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: Incorrect / Inconsistent behavior with nameref assignments in functions Chet Ramey <chet.ramey@case.edu> - 2020-08-31 11:23 -0400
csiph-web