- 论坛徽章:
- 0
|
回复 5# undeaduck
Sorry, i considered your variables are regular as "a1 a2 a3", so i used an integer i to express "a1 a2 a3" as "a$i".
Maybe your variables are not regular.
If so, replace "while ( $i<=2 )" with "foreach a (a1 a2)" and replace "a$i" with "$a" in the codes that i submit earlier.
Just like this:- #!/bin/csh
- set a1=a
- set a2=b
- foreach a (a1 a2)
- eval echo \\\$\\\?$a=\$\?$a #for debug
- eval if \( \$\?$a \) then
- eval echo \$a
- eval unset $a
- endif
- eval echo \\\$\\\?$a=\$\?$a #for debug
- end
复制代码 |
|