52 lines
1.3 KiB
Bash
52 lines
1.3 KiB
Bash
# System wide environment set up for the ash, bash, ksh and zsh shells.
|
|
|
|
# The default search path.
|
|
PATH=/usr/bin:/bin:/usr/local/bin
|
|
|
|
# Add sbin paths for root users.
|
|
[ "$(id -u)" = "0" -o "$(id -g)" = "0" ] && \
|
|
PATH=/usr/sbin:/sbin:/usr/local/sbin:$PATH
|
|
|
|
# Set PATH to include a user's private bin if it exists.
|
|
[ -d "~/bin" ] && PATH="~/bin:$PATH"
|
|
|
|
# Append /usr/games to PATH if it exists.
|
|
[ -d /usr/games ] && PATH=$PATH:/usr/games
|
|
|
|
# Set a default terminal type if none was detected.
|
|
[ "$TERM" = "" -o "$TERM" = "unknown" ] && TERM=linux
|
|
|
|
# Use the system inputrc if the user does not have their own.
|
|
[ ! -r ~/.inputrc ] && INPUTRC=/etc/inputrc
|
|
|
|
# Set the HOSTNAME environment variable.
|
|
HOSTNAME="$(cat /etc/HOSTNAME)"
|
|
|
|
# Shell prompts.
|
|
PS2='> '
|
|
PS3='#? '
|
|
PS4='+ '
|
|
|
|
# Custom setup for specific shells.
|
|
if [ -n "$ZSH_VERSION" ]; then # Zsh
|
|
PS1='%n@%m:%~%# '
|
|
elif ([ -n "${.sh.version}" ]) 2>/dev/null; then # Ksh
|
|
PS1='! ${PWD/#$HOME/~}$ '
|
|
alias hash='whence'
|
|
elif [ -n "$BASH_VERSION" ]; then # Bash
|
|
PS1='\u@\h:\w\$ '
|
|
else # Anything else
|
|
PS1='$ '
|
|
fi
|
|
|
|
# Use a reasonable create mask.
|
|
umask 022
|
|
|
|
# Set up any further environment from files in /etc/profile.d/.
|
|
for FILE in /etc/profile.d/*.sh; do
|
|
[ -x $FILE ] && . $FILE
|
|
done
|
|
unset FILE
|
|
|
|
# Export the environment just set up.
|
|
export PATH TERM INPUTRC MANPATH HOSTNAME PS1 PS2 PS3 PS4
|