[Tcsh] [PATCH] tcsh /etc/default files

Corinna Vinschen vinschen at redhat.com
Sat Feb 5 11:31:52 UTC 2022


From: Achim Gratz <Stromeko at nexgo.de>

I'm not certain if I ever discussed this before, but the recent tcsh
update reminded me that I think the defaults should be changed a little
bit.  First off, running the scripts in profile.d should IMHO be done in
csh.login to ensure it's only done once.  Secondly the (optional)
cleaning up of the PATH variable already introduced for all POSIX shells
in base-files years ago should be replicated for tcsh.  Lastly, since
/usr/bin/ and /bin are the same thing on Cygwin, one of them is
redundant and placement of /usr/local/bin should be left at the
discretion of the user since tha directory does not exist by default on
Cygwin.
---
 cygwin/csh.cshrc | 10 ----------
 cygwin/csh.login | 16 +++++++++++++++-
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/cygwin/csh.cshrc b/cygwin/csh.cshrc
index d59f30f1bd55..be0ec5d9bbef 100644
--- a/cygwin/csh.cshrc
+++ b/cygwin/csh.cshrc
@@ -3,16 +3,6 @@
 #
 onintr -
 
-if ( -d /etc/profile.d ) then
-  set nonomatch
-  foreach _s ( /etc/profile.d/*.csh )
-    if ( -r $_s ) then
-      source $_s
-    endif
-  end
-  unset _s nonomatch
-endif
-
 if (! ${?prompt}) goto end
 
 # This is an interactive session
diff --git a/cygwin/csh.login b/cygwin/csh.login
index 876b3e33c140..a92327a11596 100644
--- a/cygwin/csh.login
+++ b/cygwin/csh.login
@@ -4,7 +4,21 @@
 unsetenv TEMP
 unsetenv TMP
 
-set path=( /usr/local/bin /usr/bin /bin $path:q )
+set winpath = ( $path:q )
+if ( ${?CYGWIN_NOWINPATH} ) then
+  set path=( /usr/bin )
+else
+  set path=( /usr/bin $path:q )
+endif
+if ( -d /etc/profile.d ) then
+  set nonomatch
+  foreach _s ( /etc/profile.d/*.csh )
+    if ( -r $_s ) then
+      source $_s
+    endif
+  end
+  unset _s nonomatch
+endif
 
 if ( ! ${?USER} ) then
   set user="`id -un`"
-- 
2.34.1



More information about the Tcsh mailing list