39 lines
743 B
Bash
39 lines
743 B
Bash
# /etc/profile
|
|
|
|
# Function to easily append a directory to PATH
|
|
append_path() {
|
|
if [ -z "$1" ]; then
|
|
return 1
|
|
elif ! [ -d "$1" ]; then
|
|
return 1
|
|
fi
|
|
export PATH="$PATH":"$1"
|
|
}
|
|
|
|
# Appending paths
|
|
append_path '/usr/sbin'
|
|
append_path '/usr/local/bin'
|
|
append_path '/usr/local/sbin'
|
|
|
|
# Source locale.conf
|
|
if [ -f /etc/locale.conf ]; then
|
|
set -a
|
|
. /etc/locale.conf
|
|
set +a
|
|
fi
|
|
|
|
# Source scripts in profile.d
|
|
if [ -d /etc/profile.d ]; then
|
|
for f in /etc/profile.d/*.sh; do
|
|
[ -r "$f" ] && . "$f"
|
|
done
|
|
fi
|
|
|
|
# Unsetting functions
|
|
unset -f append_path
|
|
|
|
# Run /etc/bashrc if running in a non-posix-compliant bash shell and if the file exists
|
|
if [ -f /etc/bashrc ] && [ -n "$BASH" ] && [ -z "$POSIXLY_CORRECT"]; then
|
|
. /etc/bashrc
|
|
fi
|