I'm taking my first Linux class so, I'm still learning.
I want to build a user-variable with value. I want to pass the variable-name to sub-script and have it print the value stored in the passed-variable name. I can't figure out the syntax. I've tried lots of different syntax and can't get it to work. Example below. Anyone got some advice?
script1
*******
var_name=%1
var_value=%2
$var_name=$var_value
./script2 $var_name
script2
*******
echo ${$%1}
mike
I want to build a user-variable with value. I want to pass the variable-name to sub-script and have it print the value stored in the passed-variable name. I can't figure out the syntax. I've tried lots of different syntax and can't get it to work. Example below. Anyone got some advice?
script1
*******
var_name=%1
var_value=%2
$var_name=$var_value
./script2 $var_name
script2
*******
echo ${$%1}
mike