Setting environment variables permanently.

Tom H tomh0665 at gmail.com
Wed Mar 24 11:57:14 UTC 2010


>>> I am a little confused on the use of environment variables in Ubuntu. In
>>> windows I would simply set the variables value in the autoexec.bat file,
>>> and it would be available for use. I have been reading the man pages,
>>> and info pages for export, and env, and the following session has resulted.

>>> Hmmm, not persistent after the -p with export, and not persistent
>>> between bash sessions either. How do I set an environment variable which
>>> will always be available when I start a bash session, or run a bash script?

>> Use
>>  export some_var=some_value
>> in your ~/.bashrc

> You could also put the line in ~/.profile. This is useful if you want
> the variable to be available outside of bash as well, e.g., in a
> graphical application launched from the menu.

Except that ~/.profile is not executed for a non-login shell.




More information about the ubuntu-users mailing list