2020-05-23 10:10:24 +02:00
|
|
|
# Set $PATH
|
|
|
|
# Put only directories in $PATH that exist and remove duplicates
|
|
|
|
typeset -U path # No duplicates
|
|
|
|
path=()
|
2020-05-02 20:23:30 +02:00
|
|
|
|
2020-05-23 10:10:24 +02:00
|
|
|
_prepath() {
|
|
|
|
for dir in "$@"; do
|
|
|
|
dir=${dir:A}
|
|
|
|
[[ ! -d "$dir" ]] && return
|
|
|
|
path=("$dir" $path[@])
|
|
|
|
done
|
|
|
|
}
|
2020-05-01 00:12:02 +02:00
|
|
|
|
2020-05-23 10:10:24 +02:00
|
|
|
_prepath /usr/local/bin /bin /usr/local/sbin # General
|
|
|
|
_prepath /usr/bin /usr/sbin /sbin /Library/Apple/usr/bin # macOS
|
|
|
|
_prepath /usr/sbin /sbin # FreeBSD
|
|
|
|
|
|
|
|
_prepath "$HOME/bin"
|
|
|
|
|
|
|
|
unfunction _prepath
|
2016-04-17 09:53:29 +02:00
|
|
|
|
|
|
|
uname -npsr
|
|
|
|
uptime
|