Skip to main content
Post Closed as "Duplicate" by muru, Scott - Слава Україні, Thomas Dickey, Gilles 'SO- stop being evil' bash
added 22 characters in body; edited tags; edited title
Source Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k

get environment variable by environmentvariable name?

forFor example, I have a variable:

env_name="GOPATH"

nowNow I want to get the system GOPATHenvironment variable GOPATH as if like this:

echo $GOPATH

howHow can I get $GOPATH by $env_name?

get environment by environment name?

for example, I have a variable:

env_name="GOPATH"

now I want to get the system GOPATH like this:

echo $GOPATH

how can I get $GOPATH by $env_name?

get environment variable by variable name?

For example, I have a variable:

env_name="GOPATH"

Now I want to get the environment variable GOPATH as if like this:

echo $GOPATH

How can I get $GOPATH by $env_name?

Source Link
roger
  • 799
  • 1
  • 5
  • 4

get environment by environment name?

for example, I have a variable:

env_name="GOPATH"

now I want to get the system GOPATH like this:

echo $GOPATH

how can I get $GOPATH by $env_name?