On 5/4/16 12:30 PM, Piotr Grzybowski wrote: > Hey, > > after another discussion with Grisha, and following one of his remarks, I > kindly request your opinion on the attached patch (like: bad, not needed, > already done, weak as it stands, harmful, etc.). It addresses the exporting > of identifiers with have nameref attribute set. > at the moment we have: > > #a=10; declare -nx ra=a; bash -c 'echo "a:$a, ra:$ra, ra_excl:${!ra}."' > a:, ra:a, ra_excl:. > #a=10; declare -n ra=a; export ra; bash -c 'echo "a:$a, ra:$ra, > ra_excl:${!ra}."' > a:10, ra:a, ra_excl:10
I'm not going to add another option to export before bash-4.4 is released. This discussion, as useful as it's been, has already delayed the release too long. The above behavior is a pretty straightforward application of the nameref rules: in the first case, ra is assigned `a' but never dereferenced; in the second case, `ra' is dereferenced when used as the argument to `export'. `unset' works the same way. bash and ksh93 work the same with the second case, though ksh93, for some reason, doesn't allow -nx in any combination as options to typeset. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/