Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14899 > unrolled thread
| Started by | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| First post | 2018-12-09 01:28 -0500 |
| Last post | 2018-12-09 01:28 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
assignment to a nameref that resolves to the temporary environment Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:28 -0500
| From | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| Date | 2018-12-09 01:28 -0500 |
| Subject | assignment to a nameref that resolves to the temporary environment |
| Message-ID | <mailman.5421.1544336916.1284.bug-bash@gnu.org> |
When a nameref local to a higher function scope points to a variable in the
temporary environment, that nameref (correctly, it seems) expands to the
value
of the target variable from the temporary environment. However, assignment
to
the nameref modifies the variable from the higher scope, bypassing the
tempenv:
$ a() { local -n ref=var; var=tmp b; echo $ref; }
$ b() { ref=$ref; }
$ var=foo; a
tmp
Back to top | Article view | gnu.bash.bug
csiph-web