In csh or tcsh, is this 'set variables' available?

26 Views Asked by At

I have used the csh/tcsh script before I learned bash. I've heard that csh has some issues compared to bash. However, my code was mostly written in csh, so I need to address this problem. I've simplified my problem as follows:

echo test1 test2 | awk -v col=color 'BEGIN{while((getline<col)>0){color[++i]=$1};}{for(i=1;i<=NF;i++){printf("select \\\052/%s ; color %s ; ",i,color[i])}}'

where color file includes

red
blue
green

the output ; this is fine

select \*/1 ; color red ; select \*/2 ; color blue ;

but my problem is that i want to assign a variable (aaa) having the output like the command

set aaa = `echo test1 test2 | awk -v col=color 'BEGIN{while((getline<col)>0){color[++i]=$1};}{for(i=1;i<=NF;i++){printf("select \\\052/%s ; color %s ; ",i,color[i])}}'`

it fails in csh. Could u let me know how to solve the problem?

Thanks,

0

There are 0 best solutions below