logoalt Hacker News

JdeBP • today at 3:21 PM • 0 replies • view on HN

The Z shell's, C shell's, and others's syntaxes for setting the PATH environment variable via a shell array variable alias also does the tilde expansion.

    path=( $path ~/bin )
It's worth noting, also, that the path and manpath settings in login.conf(5) expand leading tildes in individual search path items.

* https://man.freebsd.org/cgi/man.cgi?query=login.conf&sektion...

So putting the addition of things like ~/bin to PATH in /etc/login_conf and ~/.login_conf instead of shell scripts is another way to address it.

    :path=~/bin /usr/local/bin /usr/pkg/bin /usr/bin /bin:
It's particularly handy when there are multiple login shells in use.

* http://jdebp.uk./FGA/BSDs-for-Linux-users/login-conf.html