Re: HOME as ~ in default PATH inherited from /etc/login.conf doesn't work for tcsh

From: Jackie <jiangjun12321_at_yahoo.com>
Date: Thu, 19 Oct 2023 08:52:45 UTC
<div dir='auto'>Thanks for sharing. Coping &amp; pasting your configs into my dot files tonight.</div><div class="gmail_extra"><br><div class="gmail_quote">2023年10月19日 14:18,Polytropon &lt;freebsd@edvax.de&gt;写道:<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">On Wed, 18 Oct 2023 19:32:13 +0800, Jackie wrote:&#13;<br>
&gt; Ok so this is very interesting. I did two different tests.&#13;<br>
&gt; &#13;<br>
&gt; First I pkg install slim and XDM as my login managers / display managers.&#13;<br>
&gt; I did not have a ~/.xinitrc file so slim just say failed to execute login&#13;<br>
&gt; command.&#13;<br>
&#13;<br>
In case the C shell is your login shell, and you use a&#13;<br>
display manager (or "text mode" login first, then "startx"),&#13;<br>
the following approach might be helpful:&#13;<br>
&#13;<br>
First, ~/.xsession:&#13;<br>
&#13;<br>
&#9;#!/bin/csh&#13;<br>
&#9;source ~/.cshrc&#13;<br>
&#9;exec ~/.xinitrc&#13;<br>
&#13;<br>
This will obviously source your user-local settings for&#13;<br>
the C shell, as well as those that might already be global&#13;<br>
in /etc/csh.cshrc, in where I have this:&#13;<br>
&#13;<br>
&#9;set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /opt/bin $HOME/bin)&#13;<br>
&#13;<br>
However, using ~/bin istead of $HOME/bin should also work.&#13;<br>
&#13;<br>
Then, in ~/.xinitrc, put your actual X initialization&#13;<br>
commands, like this:&#13;<br>
&#13;<br>
&#9;#!/bin/sh&#13;<br>
&#9;[ -f ~/.xmodmaprc ] &amp;&amp; xmodmap ~/.xmodmaprc&#13;<br>
&#9;numlockx&#13;<br>
&#9;xsetroot -solid rgb:3b/4c/7a&#13;<br>
&#9;xset b 100 1000 15 &amp;&#13;<br>
&#9;xset r rate 250 30 &amp;&#13;<br>
&#9;xset s off &amp;&#13;<br>
&#9;xset -dpms &amp;&#13;<br>
&#9;exec wmaker&#13;<br>
&#13;<br>
The last line, starting with "exec", easily determines&#13;<br>
which window manager or desktop environment you want.&#13;<br>
If you need localized keyboard settings, use a X config&#13;<br>
file in /usr/local/etc/X11/xorg.conf.d/ for this, so it&#13;<br>
will be in effect no matter which window manager or desktop&#13;<br>
environment you are using (except of course it knows better&#13;<br>
than you and overrides your global setting because stupid).&#13;<br>
&#13;<br>
Advantage: The X session will pick up your C shell settings,&#13;<br>
no matter how it will be started, and you don't need to&#13;<br>
have to maintain two "synchronized" X startup files.&#13;<br>
&#13;<br>
I'm using this for decades (with xdm). The #! lines aren't&#13;<br>
actually neccessary, but they tell you what "language" the&#13;<br>
files are written in. ;-)&#13;<br>
&#13;<br>
Disadvantage: This is C shell specific and does _not_&#13;<br>
work for other shells you might use interactively or&#13;<br>
as login shell (such as sh, bash, zsh, ksh).&#13;<br>
&#13;<br>
&#13;<br>
&#13;<br>
-- &#13;<br>
Polytropon&#13;<br>
Magdeburg, Germany&#13;<br>
Happy FreeBSD user since 4.0&#13;<br>
Andra moi ennepe, Mousa, ...&#13;<br>
&#13;<br>
</p>
</blockquote></div><br></div>