Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

variable substution

SOLVED
Go to Solution
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
Honored Contributor 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
Highlighted
Honored Contributor Honored Contributor

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