dotfiles/.config/zsh/conf.d/10-path.zsh

20 lines
509 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 /usr/local/bin # Homebrew on macOS
2021-01-13 23:29:53 +01:00
_prepath ~/bin ~/.local/bin # $HOME
2020-05-24 23:16:31 +02:00
unfunction _prepath