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

22 lines
525 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
path=("$dir" $path[@])
done
}
_prepath /usr/local/bin /bin /usr/local/sbin # General
_prepath /usr/bin /usr/sbin /sbin /Library/Apple/usr/bin # macOS
2020-05-24 23:16:31 +02:00
_prepath /usr/sbin /sbin # FreeBSD
2020-06-02 15:59:14 +02:00
_prepath ~/bin
2020-11-28 15:58:56 +01:00
_prepath ~/.local/bin
_prepath /opt/homebrew/bin # Homebrew an Apple Silicon
2020-05-24 23:16:31 +02:00
unfunction _prepath