Re: Combining variables

From: Green, Simon (Simon.Green@EU.ALTRIA.COM)
Date: Thu Mar 18 2004 - 11:46:11 EST


If you've got a simple number as the second part, then an array might be a
good solution.
PARM[$AZ]=hello
echo ${PARM[$AZ]}

Otherwise, you could use the eval command.
e.g. eval echo \$PARM$AZ

--
Simon Green
Altria ITSC Europe Ltd
AIX-L Archive at https://new-lists.princeton.edu/listserv/aix-l.html
<https://new-lists.princeton.edu/listserv/aix-l.html>
New to AIX? http://publib-b.boulder.ibm.com/redbooks.nsf/portals/UNIX
<http://publib-b.boulder.ibm.com/redbooks.nsf/portals/UNIX>
N.B. Unsolicited email from vendors will not be appreciated.
Please post all follow-ups to the list.
  -----Original Message-----
From: Raj Atwal [mailto:atwalrs@YAHOO.COM]
Sent: 18 March 2004 15:20
To: aix-l@Princeton.EDU
Subject: Combining variables
PARM10=hello
AZ=10
If I have the above in a script and I want to echo the value of my parameter
PARM10, how would I do that by combining my AZ parameter. For instance I
want to be able to do
echo $PARM$AZ
and have it echo the value of PARM10 to say hello. I can't figure how to
quote it to expand $PARM10.


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:43 EDT