Setting environment variables permanently.

Liam O'Toole liam.p.otoole at gmail.com
Wed Mar 24 10:00:42 UTC 2010


On 2010-03-24, Florian Diesch <diesch at spamfence.net> wrote:
> Ray Parrish <crp at cmc.net> writes:
>
>> 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
>
>
>    Florian

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.

-- 
Liam O'Toole
Birmingham, United Kingdom






More information about the ubuntu-users mailing list