Chris T
Chris T

Reputation: 483

Where does bash store environment variables?

I would like to permanently delete two env variables used in my WSL instance (using bash as my shell). Right now I have to unset these variables every time I want to disable them. I know all I have to do is delete the corresponding lines of the configuration file containing these variables, but ~.bash_rc has no environment variables and /etc/environment has only one variable (I can see far more when I type the env command). I also don't have a ~.bash_profile as far as I can tell. I'm at my wits end trying to figure out where these bash variables might be residing. Any thoughts of where I should look?

Upvotes: 0

Views: 130

Answers (1)

Jetchisel
Jetchisel

Reputation: 7791

You can try the PS4 variable and grep but keep in mind that an update might revert whatever you have edited/removed.

PS4='+$BASH_SOURCE:' bash -xilc '' 2>&1 | grep MY_ENV_VARIABLE

You can have a look at the manual about the meaning of -x -i -l -c options.

Upvotes: 2

Related Questions