Robert Durkacz
2018-07-03 12:09:24 UTC
How could I write a shell script that takes two arguments, the first to be
interpreted as the name of an environment variable and the second to be the
value of that variable? All the script should do is create an environment
variable with that value.
Whatever I try, I cannot get the shell to evaluate some expression and use
the result as a variable name. Thus for instance
varvar=var
$varvar=val
results in
var=val: command not found
In other words, can I obtain the name of a name of a variable from another
variable?
interpreted as the name of an environment variable and the second to be the
value of that variable? All the script should do is create an environment
variable with that value.
Whatever I try, I cannot get the shell to evaluate some expression and use
the result as a variable name. Thus for instance
varvar=var
$varvar=val
results in
var=val: command not found
In other words, can I obtain the name of a name of a variable from another
variable?