bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unset does not act as expected on namerefs


From: Shawn Wilson
Subject: Re: unset does not act as expected on namerefs
Date: Tue, 26 May 2015 17:02:43 -0400
User-agent: Mutt/1.5.22+19 (8f62001989cc) (2013-10-16)

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 wrote:
> > # Here we 'unset ref', which actually unsets 'var'. Then, we assign 'var' to
> > # 'ref', but since 'ref' is still a nameref, it instead assigns 'var' to 
> > 'var'.
> > address@hidden:~$ unset ref; ref=var; echo "$ref"; declare -p ref
> > var
> > declare -n ref="var"
> > address@hidden:~$ 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.

Attachment: pgpFQm6Wo47RH.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]