Reputation: 71
I have previously set an environment variable using:
echo export "AVARIABLE=example" >> ~/.bash_profile
but now after using:
unset AVARIABLE
the env var remains when I open a new shell? What am I doing wrong here? Even running:
source ~/.bash_profile
does not work?
Upvotes: 2
Views: 5138
Reputation: 25449
If you are opening a new shell, about the first thing it does is to source ~/.bash_profile
. And there, the variable is set again.
If you want to get rid of it permanently, edit your ~/.bash_profile
to remove the line in question again. (This will only take effect for new sessions.)
If you only want to unset it in your current shell, then unset
is fine but as you've seen, it won't affect new invocations of the shell.
Upvotes: 4