1753436 Members
4696 Online
108794 Solutions
New Discussion юеВ

Re: variable substution

 
SOLVED
Go to solution
claudio testa
Occasional Advisor

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.
2 REPLIES 2
Mark Greene_1
Honored Contributor

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
harry d brown jr
Honored Contributor
Solution

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