Request for help with kdm & environment variables

James Richard Tyrer tyrerj at
Sun Oct 12 05:25:10 BST 2003

Robert P. Goldman wrote:
> I'm trying to figure out how to get my environment variables in effect
> in applications that run under KDE (on linux).  I use tcsh as my
> shell.
> So I made the following .xsession file, per the instructions in the
> KDE manuals:
> ----------------------------------------------------------------------
> #!/bin/tcsh
> source ~/.tcshrc
> ----------------------------------------------------------------------
> Unfortunately, this does not appear to have any effect, and the
> environment variables I setenv in ~/.tcshrc aren't available to
> applications started from the KDE menu.  There's nothing printed in
> .xsession-errors that shows anything going wrong.

I will assume that you are using KDM to start KDE since this problem 
doesn't occur when you use: "startx" from a console.

The problem is that the shell is NOT doing a login.  I am only familiar 
with Bash, but except for the file names, it should be the same.  You have 
two files which need to be run at login.  According to the Fine Man page at 
login it first executes: "/etc/csh.cshrc" & "/etc/csh.login" & and then 
"~/.tcshrc".  A non login should execute: "/etc/csh.cshrc" and then 
"~/.tcshrc".  This means that the script: "/etc/csh.login" is the one that 
is login specific.  This is different from Bash which also runs a user 
login script.  However, it is possible that your system scrip: 
"/etc/csh.login" might also source a use script which is run at login.

You made a: "~/.xsession" script.  There is an important thing to remember 
here.  These scripts are not magic, something must run them.  KDM ONLY 
executes the "Xsession" script.  What ever else happens is totally 
determined by that script.  If it sources: "~/.xsession" it will run, if 
not then it won't.  If it sources your: "/etc/csh.login" it runs otherwise 
it isn't.

You didn't say which script is supposed to be setting your environment 
variables and when you need them to go into effect.

With Bash, one solution that usually works is to make the: "Xsession" 
script a login script.  To do that for 'tcsh', change the first line to:

	#!/bin/tcsh -

or something like that.

Note, if you: "Xsession" script is being run by: "/bin/sh" then it isn't 
going to run the 'tcsh' scripts, it is going to run the Bash ones.  You 
would probably know that since I think you would have needed to write a 
new: "Xsession" script to use 'tcsh'.


This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list