On Wed, May 06, 2009 at 04:53:27PM -0700, J. Greg Davidson wrote:
> What's the best way to update a variable indirectly, e.g. when its name is
> passed to an update function?
http://mywiki.wooledge.org/BashFAQ/006
"J. Greg Davidson" writes:
> Here are the convenience functions I use now:
>
> # simple_set VARIABLE_NAME VALUE...
> # sets the named variable to the specified value/list
> simple_set() {
> local -r name="${1}" ; shift
> eval "${name}='${*}'"
> }
This will fail if $* contains single quot
What's the best way to update a variable indirectly, e.g. when its name is
passed to an update function? Since I wrote the functions below some time
ago and I've wondered whether there might be a better way. It would be
nice if indirect parameter assignment was as easy as indirect parameter
acces