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

Re: /etc/profile and X



-- David Fokkema <dfokkema@ileos.nl> wrote
(on Thursday, 12 June 2003, 01:10 PM +0200):
> Yes, I searched through the archives and read some of the comments.
> However, they don't tell me exactly what's going on...
> 
> /etc/profile is read by a login shell, and not by starting an xterm. Of
> course, so far, so good... However, when I log in to X, doesn't
> xdm/kdm/gdm run a login shell which then starts xinit or something like
> that? Apparantly not, because if I export a variable from /etc/profile,
> I don't see it in X. What does xdm/kdm/gdm do then?
> 
> So, how do I set a variable like CUPS_SERVER=nebula so that it is set
> during a console login _and_ during an X login?

Not sure what shell you're using, but in bash, I do the following:

1) In $HOME/.bashrc (this could be in the profile somewhere; I don't
   manage a large system), I set and export any environment variables I
   need in my login shell.

2) In $HOME/.bash_profile, I have the following lines at the top of the
   file:
   # Get the aliases and functions
   if [ -f ~/.bashrc ]; then
       . ~/.bashrc
   fi

3) In $HOME/.xsession (which is called by xdm, gdm, and kdm), I add the
   very same lines above at the top of that file, before any specific items
   needed for the xsession.

Doing the above means I only need to change one file when I want to
change my environment, and ensures that that environment is available
whenever and whereever I'm working (login shell, non-login shell, and X
session).

-- 
Matthew Weier O'Phinney
matthew@weierophinney.net
http://matthew.weierophinney.net



Reply to: