problem with variables

hi all ,

i wanted to know if someone knows how can i use
a variable inside another variable

e.g.

#!/bin/csh
foreach test(1 2 3)
set sta_$test = "2"

 \#\#now its the problem i want to echo the new var
 \#$sta_$test , each time with anothe num \($test = 1 , 2 etc...\)
 
       echo $sta_$test
          end

does anyone has an idea ??

thanks a lot

udi

The way you do this in the bourne, korn, bash family is via the "eval" command. I see on my man page for csh that csh has the eval command and it says "(Same behavior as sh(1).)". So I guess this may work. I'll let you test it. But try:

eval set sta_$test = "2"

eval echo \$sta_$test

hi

i think it works !!!

thanks a lot !!!!!!!! :slight_smile:

udi