dotfiles/.config/zsh/lib/10-path.zsh

20 lines
502 B
Bash
Raw Normal View History

2020-05-24 23:16:31 +02:00
# Set $PATH
# Put only directories in $PATH that exist and remove duplicates
typeset -U path # No duplicates
path=()
_prepath() {
for dir in "$@"; do
dir=${dir:A}
[[ ! -d "$dir" ]] && return
2021-01-13 23:29:53 +01:00
#path=("$dir" $path[@])
path=("$dir" $path)
2020-05-24 23:16:31 +02:00
done
}
2021-01-13 23:29:53 +01:00
_prepath /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin # BSD and macOS
_prepath /opt/homebrew/bin /opt/homebrew/sbin # Homebrew on Apple Silicon
_prepath ~/bin ~/.local/bin # $HOME
2020-05-24 23:16:31 +02:00
unfunction _prepath