[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A strange experiment: where to set a X-session-wide environment?



On Fri, May 18, 2007 at 08:51:42PM +0800, Wei Chen wrote:
> 
> I have done a small experiment and got a strange result.
> 1. write `export SOME_VARIABLE=something' in .bash_profile
> 2. logout kde and login again
> 3. write a simple script (see following) to test whether the environment
> is set. I clicked the script file directly in konqueror to run it and
> the script used `/bin/csh` in order not to open a bash shell. (I thought
> even in somewhere a bash shell was involved, it should not be a login
> shell so .bash_profile should not be sourced in this step)
> 
> #!/bin/csh
> kdialog --msgbox "The variable is $SOME_VARIABLE"
> 
> I didn't expect it to work since I didn't think .bash_profile should
> have been sourced anywhere in the experiment. However I got the value of
> the variable with no problem.
> 
> Would anyone please tell me:
> 1. where was the .bash_profile file sourced?

Your display manager did this for you:

 |-gdm---gdm-+-Xorg
 |           `-sh---WindowMaker---WindowMaker-+-firefox-bin---8*[{firefox-b+
 |                                            |-gnome-terminal-+-bash---mut+
 |                                            |                |-bash---pst+
 |                                            |                |-gnome-pty-+
 |                                            |                `-{gnome-ter+

> 2. what is the correct place if I want to set a X-session-wide environment?
> 
I seems like you already have accomplished that.  However, if you mean
the Xsession without the parent shell, then probably
/etc/X11/Xsession.d/ or /etc/X11/Xsession.  Of course, if you launch an
xterm or other terminal emulator from your Xsession then it will get the
variable.

Regards,

-Roberto

-- 
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

Attachment: signature.asc
Description: Digital signature


Reply to: