dotfiles/.bash_profile

78 lines
2.2 KiB
Bash

# Source bash specific set up,
[[ -f ~/.bashrc ]] && . ~/.bashrc
# Environment.
export EDITOR="nano"
export LANG="en_GB.UTF-8"
export LC_COLLATE="POSIX" # 'C' causes issues with some applications
# export LC_CTYPE="POSIX" # Not sure why I set this in the first place...
export LESS="-RMi -PM?f%F:stdin. -- Page %dt of %D -- %lt/%L (%Pt\%)$"
export PAGER="less"
export PATH="/usr/local/sbin:/usr/sbin:/opt/sbin:/sbin:$PATH"
export VISUAL="$EDITOR"
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
# Platform specific set up.
PLATFORM="$(uname -s)"
if [[ "$PLATFORM" = "Linux" ]]; then
export I_WANT_A_BROKEN_PS=1
export LYNX_CFG="$HOME/.lynx.cfg"
export LYNX_LSS="$HOME/.lynx.lss"
export MANPAGER="less"
export MANPATH="$HOME/.local/share/man:$MANPATH"
hash dircolors >/dev/null 2>&1 && eval "$(dircolors -b ~/.dir_colors)"
elif [[ "$PLATFORM" = "Darwin" ]]; then
export LSCOLORS="ExGxdxdxCxDxDxbcacbeae"
export MANPAGER="less -Mis -PM'Page %dt$'"
export MANPATH="/opt/local/share/man:$MANPATH"
export PATH="/opt/local/sbin:/opt/local/bin:$PATH"
else
echo "${BASH_SOURCE##*/}: unsupported platform: $PLATFORM" >&2
fi
unset PLATFORM
# Add bin directories to PATH.
[[ -d "$HOME/files/bin" ]] && export PATH="$HOME/files/bin:$PATH"
[[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"
[[ -d "$HOME/bin" ]] && export PATH="$HOME/bin:$PATH"
# Screen.
hash screen >/dev/null 2>&1 && {
# Reattach existing screens.
screen_attach
# Output some screen info.
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
if [[ ! -e ~/.hushlogin ]]; then
if [[ ! -z "$STY" ]]; then
echo "Screen $STY, window $WINDOW."
echo
else
SCREENS="$(screen -ls | grep '[[:alpha:]]' | egrep -v '^([[:digit:]]+|No) Socket(s)?')"
if [[ -n "$SCREENS" ]]; then
echo "$SCREENS"
echo
else
echo "No screens."
echo
fi
unset SCREENS
fi
fi
}
# Mail check.
[[ ! -z "$SSH_CONNECTION" ]] && {
if [[ -s /var/spool/mail/$USER ]]; then
if [[ -N /var/spool/mail/$USER ]]; then
echo "You have new mail."
echo
else
echo "You have mail."
echo
fi
# else
# echo "No mail."
# echo
fi
}