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

Re: setting variables under an X11 session



    Micha> How can i set an environment variable under an x11 session
    Micha> (not a specific xterm under x) so that they work for
    Micha> programs not opened through a terminal ( for example the
    Micha> CVSROOT var for tkcvs)

    > /etc/environment should do it.

How do you export variables set in /etc/environment?

Since login and sshd also use /etc/environment you can't put export
statements into this file.

login seems to ignore lines in /etc/environment that export variables
but sshd outputs warnings and the manual page of sshd explicitly
states:

 /etc/environment
        This file is read into the environment at login (if
        it exists).  It can only contain empty lines,  com­
        ment  lines  (that  start with ´#´), and assignment
        lines of the form name=value.

Since login and sshd export the variables set in /etc/environment
IMHO /etc/X11/Xsession should to this too.

I've inserted the following for-loop into /etc/X11/Xsession:

 if [ -f /etc/environment ]; then
   . /etc/environment
   for n in `cut -s -d= -f1 /etc/environment`; do export $n; done
 fi

Maybe it would be better to use awk and a regular expression instead of
cut to find the variable assignments.


Reply to: