bug-bash
[Top][All Lists]
Advanced

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

Re: param expansion with single-character special vars in the environmen


From: Eduardo A . Bustamante López
Subject: Re: param expansion with single-character special vars in the environment
Date: Wed, 27 Apr 2016 15:07:22 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

Here's the updated list of cases:

|  r=/; declare -n r
|  declare -n r=/
|  declare -n r; r=/
|  declare -n r; for r in /; do :; done
|  declare -n r; select r in /; do :; done <<< 1; echo x; echo $r
|  declare -n r; ((r=0))
|  ((r=0)); declare -n r
|  r=/ declare -n r
|  f() { declare -n r; }; r=/ f
|  f() { echo $r; }; declare -n r; r=/ f
|  declare -n r; : ${r:=/}
|  declare -n r; exec {r}>/dev/null
|  declare -n r; coproc r { :; }; echo $r
|  declare -r RO=x; r=$RO; declare -n r; x=y; declare -n RO; RO=z; declare -p 
RO; echo "$RO"
|  s=/; declare -n r=s; declare -n s; echo $r
|  declare -n r=s; declare -n s; s=/
|  declare -n r; getopts x r -h
|  declare -n r; mapfile r < /dev/null
|  mapfile r < /dev/null; declare -n r
|  declare -n r; printf -v r /

You can set a nameref value to an invalid identifier, but what I noticed is
that it will write the error message on *expansion* and not on assignment (this
is what bash already does).

The 'mapfile' one is interesting, because it drops the nameref attribute from
the 'r' variable.

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

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