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

From: Jackie <jiangjun12321_at_yahoo.com>
Date: Tue, 17 Oct 2023 13:48:42 UTC
<div dir='auto'><div dir="auto"></div><div><div class="elided-text"><br type="attribution"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">On Mon, Oct 16, 2023 at 09:56:08AM -0400, Jackie J wrote:
<br>

<br>
&gt; When I checked $PATH in terminal I was happy to see that ~/bin
<br>
&gt; was included and so I intended to put some scripts as shortcuts
<br>
&gt; to long commands and simple tasks there.&nbsp; However, I found that
<br>
&gt; ~/bin in my PATH won't work in tcsh as it got "command not found"
<br>
&gt; error, I have to use something like $HOME/bin or hard-code like
<br>
&gt; /home/myusername/bin.&nbsp; Apparently ~ was not interpreted.
<br>

<br>
&nbsp; I've never been able to get "~" interpreted as $HOME in my TCSH
<br>
&nbsp; startup files, so I resort to this in my .tcshrc:
<br>

<br>
&nbsp;&nbsp;&nbsp; # If running with an empty environment, set some basic stuff.
<br>
&nbsp;&nbsp;&nbsp; if (! $?HOME) then
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setenv PATH /usr/local/bin:/bin:/usr/bin
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setenv HOME `getent passwd "${LOGNAME}" | cut -f6 -d:`
<br>
&nbsp;&nbsp;&nbsp; endif
<br>

<br>
&nbsp;&nbsp;&nbsp; # Remaining aliases, prompt, etc.
<br>
&nbsp;&nbsp;&nbsp; if ( -e $HOME/.cshrc ) then
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source $HOME/.cshrc
<br>
&nbsp;&nbsp;&nbsp; endif
<br>

<br>
&nbsp;&nbsp;&nbsp; if ( -e $HOME/.aliases ) then
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source $HOME/.aliases
<br>
&nbsp;&nbsp;&nbsp; endif
<br>

<br>
&nbsp;&nbsp;&nbsp; if ( -e $HOME/.envrc.csh ) then
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source $HOME/.envrc.csh
<br>
&nbsp;&nbsp;&nbsp; endif
<br>

<br>
&nbsp;&nbsp;&nbsp; # ...
<br>

<br>
-- 
<br>
Karl Vogel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I don't speak for anyone but myself
<br>

<br>
Save the trees, wipe your butt with an owl.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --bumper sticker
<br>

<br>
</p>
</blockquote></div><br></div><div dir="auto">Good to know that I am not alone here. I was suspecting what I was doing wrong before.</div></div>