drdot
drdot

Reputation: 3347

How to check environment variable in a linux subshell?

I have a config file which I can $source and check the variable values in it. However, I do not want to contaminate my current shell environment while still want to check the value of the variables.

Any suggestions?

Upvotes: 0

Views: 234

Answers (1)

Red Cricket
Red Cricket

Reputation: 10470

Just start a second shell.

[root@feaf38f55954 ~]# cat envars
export BOOGER='yuck'
[root@feaf38f55954 ~]# env | grep BOOGER
[root@feaf38f55954 ~]# bash
[root@feaf38f55954 ~]# source envars
[root@feaf38f55954 ~]# env | grep BOOGER
BOOGER=yuck
[root@feaf38f55954 ~]# exit
exit
[root@feaf38f55954 ~]# env | grep BOOGER
[root@feaf38f55954 ~]#

Upvotes: 1

Related Questions