Results 1 to 2 of 2
#shell script
cd1 = ENGR77 #environment variable
i=1 # local var
k="cd$i"
echo "$k"
Hi every one ... I wan't to print the value of 'k' as ENGR77.but i am ...
- 02-26-2009 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
double variable substitution
#shell script
cd1 = ENGR77 #environment variable
i=1 # local var
k="cd$i"
echo "$k"
Hi every one ... I wan't to print the value of 'k' as ENGR77.but i am getting the o/p
of 'k' as 'cd1'. the problem here is with the double variable substitution.
i have tried
eval echo $k
echo k=${cd$i}
here the 'cd1' is a global variable and 'i' local variable.i am using bash shell.
- 02-26-2009 #2Linux Newbie
- Join Date
- Feb 2009
- Posts
- 99
try
cd1=ENGR77
replace
cd1 = ENGR77 #environment variable
notice space not needed with "="
and
ooo=$"cd$1" means ooo=ENGR77


Reply With Quote