[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
assignment to a nameref that resolves to the temporary environment
From: |
Grisha Levit |
Subject: |
assignment to a nameref that resolves to the temporary environment |
Date: |
Sun, 9 Dec 2018 01:28:22 -0500 |
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
- assignment to a nameref that resolves to the temporary environment,
Grisha Levit <=