.profile, .local/bin: Patch our own damn PATH

As of now, the .profile script is POSIX-noncompliant
Still working on that
This commit is contained in:
Salt 2018-11-21 15:33:07 -06:00
parent 69bbccb3ca
commit 00a2100047
2 changed files with 20 additions and 7 deletions

@ -1 +1 @@
Subproject commit bcd40f9a27e7e9058ecadc928337f8e340333b43 Subproject commit 5f7ddc31411bd302339ec287498d6fe7c4501f8e

View File

@ -33,11 +33,24 @@ else
export EDITOR="vi" export EDITOR="vi"
fi fi
# Patch PATH if necessary # Patch PATH
# This string substitution is POSIX-compliant desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.local/bin"
localbindir="$HOME/.local/bin" # Here, we eliminate the parts of the environment-supplied PATH that we already
[ "${PATH#*$localbindir}" == "$PATH" ] && export PATH="$PATH:$localbindir" # plan on using
unset localbindir IFS=":"
for path in $desiredpath; do
PATH="${PATH#*$path}"
done
unset IFS
# We remove any prepending colons to make it appear neater
while [ "${PATH:0:1}" == ":" ]; do
PATH="${PATH:1}"
done
# Then finally set up our path
PATH="$desiredpath:$PATH"
# Grab bash_completion, if it exists
[ -f "/etc/profile.d/bash_completion.sh" ] && . "/etc/profile.d/bash_completion.sh"
# If emerge exists, add emerge aliases # If emerge exists, add emerge aliases
if `which emerge > /dev/null 2>&1` ; then if `which emerge > /dev/null 2>&1` ; then
@ -97,7 +110,7 @@ alias waitwhat='echo $?'
# Set up a default PS1 # Set up a default PS1
# This *should* work for all terminals. I know it works on ksh # This *should* work for all terminals. I know it works on ksh
_ps1() { function _ps1() {
exitcode="$?" exitcode="$?"
r="\e[0m" r="\e[0m"
fg_blue="\e[34m" fg_blue="\e[34m"