# Souce 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="-Mi -PM?f%F:stdin. -- Page %dt of %D -- %lt/%L (%Pt\%)$" export MANPAGER="less -Mis -PM'Page %dt$'" 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)" # Add bin directories to PATH. [ -d ~/files/bin ] && export PATH="~/files/bin:$PATH" [ -d ~/bin ] && export PATH="~/bin:$PATH" # Platform specific set up. _PLATFORM="$(uname -s)" if [ "$_PLATFORM" = "Linux" ]; then # Environment, export I_WANT_A_BROKEN_PS=1 hash dircolors >/dev/null 2>&1 && eval "$(dircolors -b ~/.dir_colors)" elif [ "$_PLATFORM" = "Darwin" ]; then # Environment. export LSCOLORS="ExGxdxdxCxDxDxbcacbeae" export MANPATH="/opt/local/share/man:$MANPATH" export PATH="/opt/local/bin:/opt/local/sbin:$PATH" else echo "${BASH_SOURCE##*/}: unsupported platform: $_PLATFORM" >&2 fi unset _PLATFORM # SSH agent. hash ssh-add ssh-agent >/dev/null 2>&1 && { if [ ! -z "$SSH_AGENT_PID" ] && [ ! -z "$SSH_AUTH_SOCK" ]; then echo echo "Connected to forwarded ssh-agent at PID $SSH_AGENT_PID." elif [ -z "$SSH_AGENT_PID" ] || [ -z "$SSH_AUTH_SOCK" ]; then echo echo "Problem connecting to forwarded ssh-agent!" false else . ~/.ssh/agent 2>/dev/null if [ -z "$SSH_AGENT_PID" ] || ! pgrep -u "$USER" -f "$(hash -t ssh-agent)" | grep "^$SSH_AGENT_PID$" >/dev/null; then if ssh-agent -s | sed -e '/^echo/ d' >~/.ssh/agent; then . ~/.ssh/agent if ! ssh-add -l >/dev/null 2>&1; then alias ssh='ssh-add -l >/dev/null 2>&1 && unalias ssh || { ssh-add && unalias ssh; }; ssh' fi echo echo "Started new local ssh-agent at PID $SSH_AGENT_PID." else echo echo "Failed to start local ssh-agent!" false fi else echo echo "Connected to local ssh-agent at PID $SSH_AGENT_PID." fi fi } # Screen. hash screen >/dev/null 2>&1 && { if [ ! -e ~/.hushlogin ]; then if [ ! -z "$STY" ]; then echo echo "Screen $STY, window $WINDOW." else _SCREENS="$( screen -ls | egrep '[[:alpha:]]' | egrep -v '^[[:digit:]]+ Socket(s)?' )" if [ -n "$_SCREENS" ]; then echo echo "$_SCREENS" else echo echo "No screens." 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 echo "You have new mail." else echo echo "You have mail." fi else # echo # echo "No mail." fi } echo