Re: variable substution (151 Views)
Reply
Occasional Advisor
claudio testa
Posts: 10
Registered: ‎11-05-2003
Message 1 of 3 (151 Views)
Accepted Solution

variable substution

I have set MYTEST="1 2 3" and also i have set A="MY" and B="TEST".
If i do:
1) echo ${MYTEST} the output is corretc "1 2 3"
2) echo $A$B the output is "MYTEST" but i wolud like print "1 2 3", how to do?

Thanks in advance and sorry for my poor english.
Honored Contributor
Mark Greene_1
Posts: 1,422
Registered: ‎06-26-2001
Message 2 of 3 (151 Views)

Re: variable substution

You cannot do indirect variable reference like that; the closest thing available in either bourne or korn shell scrips is an array.

mark
the future will be a lot like now, only later
Honored Contributor
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 3 of 3 (151 Views)

Re: variable substution

[root@vpart1 /tmp]# eval echo \$${A}${B}
1 2 3
[root@vpart1 /tmp]#


live free or die
harry d brown jr
Live Free or Die
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.