Article View: alt.comp.lang.shell.unix.bourne-bash
Article #9How to expand variables from string?
From: Olivier Langlois
Date: Wed, 17 Oct 2007 03:24
Date: Wed, 17 Oct 2007 03:24
20 lines
1827 bytes
1827 bytes
Hi,
First, sorry if I am cross-posting this question. I am not sure to
understand the difference between the 2 newsgroups.
My problem is that I have a shell variable containing a string
composed of variable names preceded with the expension operator ('$')
and I am fighting with the shell to find a way to make the expension.
Here is an example:
var1='$HOME'
echo $var1
will display $HOME but I would like to find a construction that would
allow me to print the $HOME value from the var1 variable.
Thank you for your assistance,
Olivier Langlois
http://www.olivierlanglois.net
http://blog.olivierlanglois.net
Technical Details
Message-ID:
<1192591475.543957.112000@k35g2000prh.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!k35g2000prh.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114230,e6e9ec2e0724a623,start X-Google-Thread: 1054c0,e6e9ec2e0724a623,start X-Google-Attributes: gid114230,gid1054c0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!k35g2000prh.googlegroups.com!not-for-mail From: Olivier Langlois <olanglois@sympatico.ca> Newsgroups: alt.comp.lang.shell.unix.bourne-bash,gnu.bash Subject: How to expand variables from string? Date: Tue, 16 Oct 2007 20:24:35 -0700 Organization: http://groups.google.com Lines: 21 Message-ID: <1192591475.543957.112000@k35g2000prh.googlegroups.com> NNTP-Posting-Host: 70.52.53.172 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1192591476 17446 127.0.0.1 (17 Oct 2007 03:24:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 17 Oct 2007 03:24:36 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k35g2000prh.googlegroups.com; posting-host=70.52.53.172; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0