.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"
fi
# Patch PATH if necessary
# This string substitution is POSIX-compliant
localbindir="$HOME/.local/bin"
[ "${PATH#*$localbindir}" == "$PATH" ] && export PATH="$PATH:$localbindir"
unset localbindir
# Patch PATH
desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.local/bin"
# Here, we eliminate the parts of the environment-supplied PATH that we already
# plan on using
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 `which emerge > /dev/null 2>&1` ; then
@ -97,7 +110,7 @@ alias waitwhat='echo $?'
# Set up a default PS1
# This *should* work for all terminals. I know it works on ksh
_ps1() {
function _ps1() {
exitcode="$?"
r="\e[0m"
fg_blue="\e[34m"