How to get an environment variable in Bash?

In Bash, how to get the value (string) of an environment variable?

asked May 23, 2017 by dtivl (2,500 points)

1 Answer

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.

answered May 27, 2017 by dtivl (2,500 points)

Please log in or register to answer this question.

Related questions

1 answer
asked Oct 2, 2013 by anonymous
1 answer
asked May 23, 2017 by dtivl (2,500 points)
1 answer
asked May 23, 2017 by dtivl (2,500 points)
1 answer
1 answer
Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...