.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
|
## POSIX NOTICE
|
||||||
# This script, or at least the parts expected to be run by a standard sh
|
# 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
|
# 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
|
## SHELLCHECK
|
||||||
# Not finding these sources is none of my concern; they're out of scope
|
# Not finding these sources is none of my concern; they're out of scope
|
||||||
@ -25,23 +25,20 @@
|
|||||||
_baseshell="$(basename -- "$0")"
|
_baseshell="$(basename -- "$0")"
|
||||||
|
|
||||||
# Patch PATH
|
# Patch PATH
|
||||||
desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games"
|
unset PATH
|
||||||
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
|
|
||||||
for dir in \
|
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/coreutils/libexec/gnubin" \
|
||||||
"/usr/local/opt/gnu-sed/libexec/gnubin" \
|
"/usr/local/opt/gnu-sed/libexec/gnubin" \
|
||||||
"/usr/local/opt/grep/libexec/gnubin" \
|
"/usr/local/opt/grep/libexec/gnubin" \
|
||||||
|
Reference in New Issue
Block a user