On Wed, May 25, 2016 at 3:29 PM, Chet Ramey <chet.ramey@case.edu> wrote:
Thanks for the report. Both of these cases should be caught
Is it deliberate that with the latest changes a faulty += RHS causes an existing valid nameref to be unset?
$ declare -n ref=re
$ declare -n ref+=f
bash: ref: nameref variable self references not allowed
$ declare -p ref
bash: declare: ref: not found
$ declare -n ref=X
$ declare -n ref+=/
bash: declare: `/': not a valid identifier
$ declare -p ref
bash: declare: ref: not found
Also, this still seems to miss some stuff that would normally be caught:
$ declare -n ref=ref[0]
bash: declare: ref: nameref variable self references not allowed
$ declare -n ref=re ref+=f[0]
$ declare -p ref
declare -n ref="ref[0]"