.profile: Polish up our path patching
This commit is contained in:
parent
a829436d7e
commit
f591265ee8
31
.profile
31
.profile
@ -6,7 +6,7 @@
|
||||
## POSIX NOTICE
|
||||
# This script, or at least the parts expected to be run by a standard sh
|
||||
# implementation, should be fully POSIX-compliant. If it is not, open a bug
|
||||
# report at gitlab.com/rehashedsalt/home and I'll take care of it.
|
||||
# report at git.9iron.club/salt/home and I'll take care of it.
|
||||
|
||||
## SHELLCHECK
|
||||
# Not finding these sources is none of my concern; they're out of scope
|
||||
@ -25,23 +25,20 @@
|
||||
_baseshell="$(basename -- "$0")"
|
||||
|
||||
# Patch PATH
|
||||
desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games"
|
||||
for dir in "$HOME/.bin" "$HOME/.local/bin"; do
|
||||
if [ -d "$dir" ] && [ -O "$dir" ]; then
|
||||
desiredpath="$desiredpath:$dir"
|
||||
fi
|
||||
done
|
||||
IFS=":"
|
||||
for path in $desiredpath; do
|
||||
PATH="${PATH#*$path}"
|
||||
done
|
||||
unset IFS
|
||||
while [ "${PATH#:}" != "$PATH" ]; do
|
||||
PATH="${PATH#:}"
|
||||
done
|
||||
PATH="$desiredpath:$PATH"
|
||||
# Homebrew
|
||||
unset PATH
|
||||
for dir in \
|
||||
"$HOME/.bin" \
|
||||
"$HOME/.local/bin" \
|
||||
"$HOME/.firestarter" \
|
||||
"/usr/games" \
|
||||
"/usr/local/games" \
|
||||
"/snap/bin" \
|
||||
"/sbin" \
|
||||
"/bin" \
|
||||
"/usr/sbin" \
|
||||
"/usr/bin" \
|
||||
"/usr/local/sbin" \
|
||||
"/usr/local/bin" \
|
||||
"/usr/local/opt/coreutils/libexec/gnubin" \
|
||||
"/usr/local/opt/gnu-sed/libexec/gnubin" \
|
||||
"/usr/local/opt/grep/libexec/gnubin" \
|
||||
|
Loading…
Reference in New Issue
Block a user