Setting environment variables permanently.
Liam O'Toole
liam.p.otoole at gmail.com
Wed Mar 24 15:35:37 UTC 2010
On 2010-03-24, Tom H <tomh0665 at gmail.com> wrote:
>>>> 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.
>
Indeed. However, any non-login shell (or other application) will inherit
the exported variable from the login shell. Try it.
--
Liam O'Toole
Birmingham, United Kingdom
More information about the ubuntu-users
mailing list