-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 5/26/15 5:02 PM, Shawn Wilson wrote: > On +2015/05/26 18:05:18, Geir Hauge wrote: >> On Tue, May 26, 2015 at 11:00:45AM -0500, Eduardo A. Bustamante López wr ote: >>> # Here we 'unset ref', which actually unsets 'var'. Then, we assign 'va r' to >>> # 'ref', but since 'ref' is still a nameref, it instead assigns 'var' t o 'var'. >>> dualbus@hp:~$ unset ref; ref=var; echo "$ref"; declare -p ref >>> var >>> declare -n ref="var" >>> dualbus@hp:~$ declare -p var >>> declare -- var="var" >> >> Ah, that explains it! Mystery solved, and no longer surprising behavior. >> > > If there's no good reason to keep this as is (some use case where > this might be wanted and breaking backward compatibility - I can't > see anyone actually *wanting* it this way) shouldn't it be changed? > A behavior can be documented and still be bad.
What behavior do you want? That namerefs should act transparently (that is, use the nameref variable's non-null value as the variable name to operate on) in all contexts *except* unset? - -- ``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/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlVl1JQACgkQu1hp8GTqdKudNQCeJn533z6DE//zfQLMVFctElOg DXkAniyUQHTEfGXcYJTqWHBJDgTOW4pG =Jrw3 -----END PGP SIGNATURE-----