Hi,
I've got a small problem.
If varible A stores "B" and Variable B stores C,
How to get the value of variable B by using only Variable A..?
I tried the following but didnt work pease help..
$ var1=vikram
$ echo $var1
vikram
$ vikram=sampath
$ echo $vikram
sampath
$ echo $`echo $var1`
$vikram
In the above code
Why i'm getting "$vikram" when i was expecting "sampath" (because $vikram=sampath)
Please help me the right way to decode in the above situation..
thanks
Vikram shetty
See the following code.
var1=vikram
echo $var1
vikram=sampath
echo $vikram
eval echo \$$var1
[or]
eval echo \$$(echo $var1)
[or]
eval echo \$`echo $var1`
eval result=\$$var1
echo $result
It will print the word sampath
thanks u very much ungalnanbu and selvan..
Its working fine..
Could you please pass on me any material that describes the above behaviour of variables..
thanks
Vikram shetty
Indirect References.
http://www.linuxjournal.com/article/7385
Please go through the above URL.
This will help you to know about variables.
Thank you very much guys..
warm regards
Vikram Shetty