In Bash, how to get the value (string) of an environment variable?
In Bash, just directly use:
$VAR
Note that if you assigned a value to the “local” variable $VAR
in your program before reading the “environmental” $VAR
, the $VAR
will actually contain the value you assigned.