'Csh Variable declaration
Unable to echo $varible_$variable in csh
set a = temp
set value_${a} = 10
when trying to print the variable it isn't working. I need this to implement in nested for loop.
echo $value_$a value_: Undefined variable. (working with $value_temp)
Thanks in advance
Solution 1:[1]
Use eval, with escape of the first $ when reading a variable:
% set a = temp
% eval set var_${a}=10
% echo $var_temp
10
% eval echo \$var_$a
10
% eval set result=\$var_$a
% echo $result
10
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fork2execve |
