I have a variable $var that has values as another variable $env . $env has some value . how can I use $var to print the value of $env.
> set xyz = 'abc' set env = 'xyz' set v = '$' set var = "$v""$env"
>
> echo $var o/p: $xyz
now I want to print the value the of $ xyz using $var
Use
eval
, like this:This is more commonly known as an indirect reference.
Here is an example script:
Output: