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.
~/.profile
or~/.bashrc
(or whatever shell you are using. It is not always bash) then you set those only for yourself. They only get executed when you log in. (and only after you log in, if you changed those and did not logout and back in then they will not yet have taken effect). The same holds for /etc/profile, though that will affect all users. -- However what I am missing is your goal. Did you just choose a random example (country), or do you want to set a locale?