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

From: Karl Vogel <vogelke_at_pobox.com>
Date: Tue, 17 Oct 2023 04:18:25 UTC
On Mon, Oct 16, 2023 at 09:56:08AM -0400, Jackie J wrote:

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

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

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

    # Remaining aliases, prompt, etc.
    if ( -e $HOME/.cshrc ) then
        source $HOME/.cshrc
    endif

    if ( -e $HOME/.aliases ) then
        source $HOME/.aliases
    endif

    if ( -e $HOME/.envrc.csh ) then
        source $HOME/.envrc.csh
    endif

    # ...

-- 
Karl Vogel                      I don't speak for anyone but myself

Save the trees, wipe your butt with an owl.            --bumper sticker