Re: How to get value of environment variable in variable name?

avoncampe_at_gmail.com
Date: 08/31/05


Date: 31 Aug 2005 08:47:14 -0700


Chris F.A. Johnson wrote:

> In any Bourne-type shell:
>
> eval "value=\$$var"

Thanks! That works like a charm. The critical piece I was missing
was the backslash in front of the first $. I knew the answer would
include an eval, but the various combinations I tried didn't work.

Thanks again,
Alfred



Relevant Pages

  • Re: COM Interface intialization
    ... That works like a charm in the actual application. ... the CoClass. ... Sorry again for missing your piece of code. ... With sufficient thrust, pigs fly just fine. ...
    (microsoft.public.vc.atl)
  • Re: What is wrong with my shell scrip.
    ... add set -x in your script it will help you debug. ... My mistake ... >>> You are missing a backslash before home ...
    (Ubuntu)
  • Re: mac68k nbsd3.0 (sysinst and Mac installer both fail)
    ... installing 3.0 fresh using a manual newfs and mount worked like a ... charm. ... Missing from the documentation, however, is the fact that ...
    (comp.unix.bsd.netbsd.misc)
  • Re: missing the boat
    ... Hyphens are not special in regexes, there is no need to backslash them. ... where am I missing the boat??? ...
    (comp.lang.perl.misc)
  • Re: What is wrong with my shell scrip.
    ... You are missing a backslash before home ... write this two liner script but it does not work. ... cp: cannot create regular file ...
    (Ubuntu)