In order to export variables permanently, we can write the export command in the following files:
~/.profile
~/.bash_profile
/etc/profile
In my case, ~/.bash_profile
does not exist, and therefore I export the variable in the other two files:
export country=UK
The problem I have now is that the variable I defined (country
) is still unknown for the system. I was wondering what I should do next.
Best Answer
profile is only read when you login, have you tried a login shell
bash -login
,bash -
,logging out and then back in or just plain old rebooting?You can use
.bashrc
if want it every time you spawn a shell.