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


Groups > gnu.bash.bug > #14899 > unrolled thread

assignment to a nameref that resolves to the temporary environment

Started byGrisha Levit <grishalevit@gmail.com>
First post2018-12-09 01:28 -0500
Last post2018-12-09 01:28 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  assignment to a nameref that resolves to the temporary environment Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:28 -0500

#14899 — assignment to a nameref that resolves to the temporary environment

FromGrisha Levit <grishalevit@gmail.com>
Date2018-12-09 01:28 -0500
Subjectassignment 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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web