Red Hat Bugzilla – Bug 11140
csh does not execute /etc/profile.d
Last modified: 2014-03-16 22:13:35 EDT
Tcsh does not execute the files stored in /etc/profile.d/*.csh as bash
does. Enclosed you find a patch based upon setup-2.1.8-1 of RHAT 6.2.
This patch does:
* execute /etc/profile.d/*csh
* filename completion for "cd" and "rmdir" completes only
directories (not files)
diff -r -u setup-2.1.8/csh.cshrc setup-2.1.8-till/csh.cshrc
--- setup-2.1.8/csh.cshrc Thu Jan 13 00:18:52 2000
+++ setup-2.1.8-till/csh.cshrc Mon May 1 08:34:55 2000
@@ -5,7 +5,17 @@
if ($?prompt) then
if ($?tcsh) then
set prompt='[%n@%m %c]$ '
+ complete cd 'n/*/d/' # complete only dirs on "cd"
+ complete rmdir 'n/*/d/' # ... and rmdir
set prompt=\[`id -nu`@`hostname -s`\]\$\
+ if ( $shlvl != "1" ) then # We're not a login shell
+ foreach i (/etc/profile.d/*.csh)
+ if ( -x $i ) then
+ source $i
Created attachment 221 [details]
Patch for problem
csh.login should already read profile.d for
login shells; are you invoking (t)csh with
No, I used gdm (or xdm) to login and my user shell ist "tcsh". Therefore the
xterms are no login shell.... I'm not sure, =when= to execute the things
in /etc/profile.d/*.csh in such a case (because there is =no= login shell), but
they =should= be executed at least once.
To ensure, that all X clients have the same environment, the /etc/profile.d/
should be invoked from xdm (ot it's scripts..)?
BUT some things defined in /etc/profile.d/*.csh (e.g. DIRCOLORs) must be read
by =each= shell and should be executed in /etc/csh.cshrc. BUT some others
should only be executed once at login time.... To make this you probably have
to change semantics of /etc/profile.d/. Maybe something like:
foo-bar.csh (deprecated: executed by login and "normal" shells)
foo-bar.csh-login (executed only by login shells)
foo-bar.csh-cshrc (executed by every shell)
This is fixed in the latest setup package in rawhide.