help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] taking the name of a variable from another variable


From: Greg Wooledge
Subject: Re: [Help-bash] taking the name of a variable from another variable
Date: Tue, 3 Jul 2018 10:02:08 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Jul 03, 2018 at 09:57:20AM -0400, Daniel Mills wrote:
> On Tue, Jul 3, 2018 at 9:56 AM João Eiras <address@hidden> wrote:
> > More:
> > http://tldp.org/LDP/abs/html/ivr.html
> >
> Ew. Why not just use printf -v "$my_variable_name" %s "$another_text" ?

For the same reason he referenced the ABS: he doesn't know any better.

An alternative reference would be https://mywiki.wooledge.org/BashFAQ/006

But I did not cite that in my first response, because the first paragraph
of the actual question led to an entirely different problem which makes
the "indirect reference" syntax and all the stupid shell hacks to reverse
it completely moot.

Plus, if the goal is to index information by string keys, you should be
using an associative array instead.



reply via email to

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