[Top][All Lists]

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

Re: setvalue builtin command

From: konsolebox
Subject: Re: setvalue builtin command
Date: Thu, 4 Apr 2013 20:51:14 +0800

> Another "feature" of this kind of construct is that you can put the name
> of the variable-to-be-assigned into another variable:
> ptr=some_variable
> setvalue "$ptr" "$foo"
> Which may be a good thing or a bad thing, but either way it's definitely
> a thing that someone will (ab)use if it's available.

Well I did considered that noting that many people already tend to use the
eval hack just to assign values to variables carried inside another
variable most likely through passing of functions..

> That said, I don't think bash needs this.  Bash 4.3 is going to have
> "namerefs" (declare -n) to allow passing arguments by reference to a
> function.

I should have seen this sooner (have bash-devel but didn't check new
features). I think it would be enough for the need.

Thanks for telling me. Can't wait to use the feature soon. That would
simplify many parts of my codes.

reply via email to

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