hi all,
Assume that i a having the following three lines in an executable file
#/bin/bash
a=Tue
Tue=1
When i give echo $a the value should be 1, how to do this. Your suggestions please.
Thanks in advance,
Anish
hi all,
Assume that i a having the following three lines in an executable file
#/bin/bash
a=Tue
Tue=1
When i give echo $a the value should be 1, how to do this. Your suggestions please.
Thanks in advance,
Anish
You should initiate the Tue Variable before the a variable.
In your script, when you assign the Tue variable to a it has no value.
Your script should be like this :
#/bin/bash
Tue=1
a=Tue
And since variable 'a' does not hold value as $Tue we add another $ in the below echo statement to print Tue's value.
eval echo \$$a
Hi dude ,
The code which you posted is not working
echo $a given means it shows tue
But:
#/bin/bash
Tue=1
a=${!Tue}