proper place to set environment variables?

Charlie Kravetz cjk at teamcharliesangels.com
Tue May 13 05:46:22 CEST 2014


On Mon, 12 May 2014 17:26:02 -0700
John Gabriele <jgabriele at fastmail.fm> wrote:

>On Mon, May 12, 2014, at 11:34 AM, Chris Green wrote:
>> On Mon, May 12, 2014 at 11:09:40AM -0700, John Gabriele wrote:
>> > Hi,
>> > 
>> > I'm running as my desktop a stock Debian "Testing" (which is currently
>> > aliased to "jessie") system with Xfce 4.10, and log in graphically via
>> > LightDM.
>> > 
>> > Where is the proper location to set environment variables? That is, I
>> > tried doing so in ~/.profile, but that file does not appear to be
>> > sourced when logging into the desktop (I think it may when logging in
>> > via text console though).
>> > 
>> Things put into .profile *should* be there when you run the desktop.
>> 
>> You need to export them though,
>
>I did export them, though it still fails. Did another quick test; in my
>~/.profile, added:
>
>    export FOOBAR="hello"
>
>then logged out, logged in, and tried
>
>    echo $FOOBAR
>
>and get nothing. So, it doesn't look like ~/.profile is getting sourced.
>
>I then tried something else, which I found after more searching around:
>I tried creating a ~/.xsessionrc, then put this in it:
>
>    export PATH=$HOME/bin:$HOME/.cabal/bin:$PATH
>    export TERM=xterm-256color
>
>logout, login, and then found that `echo $PATH` shows the expected PATH
>(with ~/bin and ~/.cabal/bin in it), but `echo $TERM` returns just
>"xterm". (?!)
>
>-- John


I have always set them using the 

FOOBAR=hello
export FOOBAR

in ~/.bashrc for the user, and /etc/bashrc for the system.
Occasionally, I have had to set them in /etc/environment instead.

-- 
Charlie Kravetz
Linux Registered User Number 425914
[http://linuxcounter.net/user/425914.html]
Never let anyone steal your DREAM.   [http://keepingdreams.com]


More information about the Xfce mailing list