help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Using PE to specify an array


From: Greg Wooledge
Subject: Re: [Help-bash] Using PE to specify an array
Date: Fri, 14 Sep 2018 08:42:32 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Fri, Sep 14, 2018 at 01:09:07AM -0400, Bruce Hohl wrote:
> Question:
> Is there a way to specify _ugly_hash using Parameter Expansion of $var1? In
> the above I desired _$var1 to expand to _ugly_hash in order to add (+=) an
> additional element to that array.

It sounds like you're looking for namerefs.  declare -n.

Of course, like almost every other "feature" in bash, they only work
some of the time.

If what you REALLY REALLY WANT is a pointer to an array, or to pass
an array to a function by reference, just switch to a real programming
language.  Bash is not going to make you happy.



reply via email to

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