Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #11223

Re: need bash indirect variable help

From Todd <Todd@invalid.invalid>
Newsgroups comp.os.linux.misc
Subject Re: need bash indirect variable help
Date 2014-06-08 02:35 -0700
Organization A noiseless patient Spider
Message-ID <ln1ank$6ng$1@dont-email.me> (permalink)
References <lmvmr3$oqu$1@dont-email.me> <wwvegyzomjm.fsf@l1AntVDjLrnP7Td3DQJ8ynzIq3lJMueXf87AxnpFoA.invalid>

Show all headers | View raw


On 06/08/2014 01:03 AM, Richard Kettlewell wrote:
> Todd <Todd@invalid.invalid> writes:
>> I am trying to access a variable based on a variable.
>>
>> I have go this far:
>>
>> x=abc
>> eval ${x}Status=xyz
>> echo $abcStatus
>> xyz
>>
>> But, I won't know the exact name of the variable
>> ($abcStatus).  How do I "echo" the variable indirectly?
>>
>> Obviously
>>
>> echo "${x}Status"
>>
>> Doesn't work.
>
> Use eval again.
>
> $ eval echo \$${x}Status
> xyz
>

Hi Richard,

     Perfect.  Thank you!

-T

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

need bash indirect variable help Todd <Todd@invalid.invalid> - 2014-06-07 11:49 -0700
  Re: need bash indirect variable help William Unruh <unruh@invalid.ca> - 2014-06-07 23:42 +0000
    Re: need bash indirect variable help Eric Pozharski <whynot@pozharski.name> - 2014-06-08 12:19 +0300
      Re: need bash indirect variable help Eric Pozharski <whynot@pozharski.name> - 2014-06-09 15:07 +0300
  Re: need bash indirect variable help Richard Kettlewell <rjk@greenend.org.uk> - 2014-06-08 09:03 +0100
    Re: need bash indirect variable help Todd <Todd@invalid.invalid> - 2014-06-08 02:35 -0700
  Re: need bash indirect variable help Huibert Bol <huibert.bol@quicknet.nl> - 2014-06-08 10:29 +0200
    Re: need bash indirect variable help Todd <Todd@invalid.invalid> - 2014-06-08 02:36 -0700
  Re: need bash indirect variable help Jerry Peters <jerry@example.invalid> - 2014-06-08 20:31 +0000
    Re: need bash indirect variable help Todd <Todd@invalid.invalid> - 2014-06-08 14:53 -0700
      Re: need bash indirect variable help floyd@apaflo.com (Floyd L. Davidson) - 2014-06-08 14:50 -0800
        Re: need bash indirect variable help Jerry Peters <jerry@example.invalid> - 2014-06-09 20:44 +0000

csiph-web