Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 2023 00:18:25 -0400
From:      Karl Vogel <vogelke@pobox.com>
To:        questions@freebsd.org
Subject:   Re: HOME as ~ in default PATH inherited from /etc/login.conf doesn't work for tcsh
Message-ID:  <ZS4LEWbo4xIr8NQu@furbag>
In-Reply-To: <1244605602.16156449.1697464546558@mail.yahoo.com>
References:  <1244605602.16156449.1697464546558.ref@mail.yahoo.com> <1244605602.16156449.1697464546558@mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZS4LEWbo4xIr8NQu>