Updates for profile and bashrc; PS1 simplification

This commit is contained in:
2020-11-09 04:29:47 -06:00
parent cee344c569
commit fe260899ba
2 changed files with 54 additions and 28 deletions

View File

@@ -3,9 +3,30 @@
#Set our umask
umask 022
# Set our default path
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/bin"
# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '/usr/sbin'
append_path '/usr/bin'
append_path '/sbin'
append_path '/bin'
append_path '~/bin'
# Force PATH to be environment
export PATH
# Set IFS to be newline delimited
IFS="
"
export IFS
@@ -18,8 +39,16 @@ if test -d /etc/profile.d/; then
unset profile
fi
# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bashrc; then
# Unload our profile API functions
unset -f append_path
# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
test "$PS1" &&\
test -z "$POSIXLY_CORRECT" &&\
test "${0#-}" != sh &&\
test -r /etc/bashrc
then
. /etc/bashrc
fi
@@ -28,5 +57,3 @@ unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH