Skip to content

Instantly share code, notes, and snippets.

@tycho
Created May 31, 2009 07:15
Show Gist options
  • Save tycho/120802 to your computer and use it in GitHub Desktop.
Save tycho/120802 to your computer and use it in GitHub Desktop.
my bashrc, used for setting up common paths and preferences I have
# /etc/skel/.bash_profile
# This file is sourced by bash for login shells. The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc
# /etc/skel/.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export EDITOR=nano
# The order needs to be (right-to-left):
# 1. MacPorts
# 2. Everything but MacPorts and ccache
# 3. ccache
for a in '' /usr /usr/local /Developer/usr /opt/local $(find /opt/ -maxdepth 1 2> /dev/null | sed 's/\/\//\//g' | grep -v local$) /opt/intel/cc/* /opt/intel/cce/* /opt/intel/Compiler/*/* /usr/local/intel/cc $HOME; do
FULLPATH=$a
if [ -x $FULLPATH ]; then
if [ -x $FULLPATH/bin ]; then
export PATH="$FULLPATH/bin:$PATH"
fi
if [ -x $FULLPATH/sbin ]; then
export PATH="$FULLPATH/sbin:$PATH"
fi
if [ -x $FULLPATH/games ]; then
export PATH="$FULLPATH/games:$PATH"
fi
if [ -x $FULLPATH/share/applications ]; then
export XDG_DATA_DIRS="$FULLPATH/share:$XDG_DATA_DIRS"
fi
if [ -x $FULLPATH/share/aclocal ]; then
export ACLOCAL_FLAGS="-I $FULLPATH/share/aclocal $ACLOCAL_FLAGS"
fi
if [ -x $FULLPATH/man ]; then
export MANPATH="$FULLPATH/man:$MANPATH"
fi
if [ -x $FULLPATH/share/man ]; then
export MANPATH="$FULLPATH/share/man:$MANPATH"
fi
if [ -x $FULLPATH/lib/pkgconfig ]; then
export PKG_CONFIG_PATH="$FULLPATH/lib/pkgconfig/:$PKG_CONFIG_PATH"
fi
if [ -x $FULLPATH/lib/python2.5/site-packages ]; then
export PYTHONPATH="$FULLPATH/lib/python2.5/site-packages/:$PYTHONPATH"
fi
if [ -x $FULLPATH/lib/python2.6/site-packages ]; then
export PYTHONPATH="$FULLPATH/lib/python2.6/site-packages/:$PYTHONPATH"
fi
fi
done
# Linux
if [ -x /usr/lib/ccache ]; then
export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:$PATH"
fi
# Mac OS X
if [ -x /opt/local/libexec/ccache ]; then
export PATH="/opt/local/libexec/ccache:$PATH"
fi
# FreeBSD
if [ -x /usr/local/libexec/ccache ]; then
export PATH="/usr/local/libexec/ccache:$PATH"
fi
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# If keychain is installed, we can use this to store
# SSH keys in the SSH agent.
if [ "$(which keychain 2> /dev/null)" != "" ]; then
keychain -q -Q "$HOME"/.ssh/*.ssh
source "$HOME/.keychain/$HOSTNAME-sh"
fi
# Detect the OS for later platform-specific needs.
echo -n "Detecting operating system... "
OSNAME="$(uname -s)"
echo "$OSNAME"
# Check how the colors are set for the 'ls' command
echo -n "Checking 'ls' command type... "
ls --help &> /dev/null
if [ $? -ne 0 ]; then
echo "BSD"
export CLICOLOR=1
export LSCOLORS=ExFxCxDxCxegedabagacad
else
echo "GNU"
alias ls="ls --color=auto"
fi
# On some distributions of Linux, it tries to
# use the DGA mouse driver, which breaks things
# terribly.
echo -n "Checking if mouse hack is needed... "
if [ "$OSNAME" == "Linux" ]; then
echo "Yes"
export SDL_VIDEO_X11_DGAMOUSE=0
else
echo "No"
fi
# If we're on Linux, we want to ensure we use
# the ALSA sound driver since it is far better
# than other options.
echo -n "Checking for SDL audio driver... "
if [ "$OSNAME" == "Linux" ]; then
echo "ALSA"
export SDL_AUDIODRIVER="alsa"
else
echo "Default"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment