Newbee
Newbee

Reputation: 1

Linux environment variable

Is there any command to get only the exported variables in RHEL.

For ex: If I exporting multiple variable line by line like below,

export AIR_HOME=value1
export PATH=value2

Is there any command to see only the exported variables. I tried printenv and env and it didn't worked for me it is printing the entire environment variables. Also echo $AIR_HOME will not work in my case since the exported variable name will change in different situation.

Upvotes: 0

Views: 129

Answers (2)

Kurtis Rader
Kurtis Rader

Reputation: 7459

Your question doesn't make any sense. The printenv and env commands do exactly what you asked for: they print only the exported vars. There is no way to distinguish the vars you added to the environment via the export builtin from those already in the environment.

Upvotes: 1

Eugene Ogongo
Eugene Ogongo

Reputation: 375

Just:

echo "$VARIABLENAME"

For example for the environment variable $AIR_HOME, use:

echo "$AIR_HOME"

Upvotes: 0

Related Questions