2011-05-27

Load machine-dependent bash setting

I own several computers and each is running different OS on it. We all know that maintaining different settings for different OS is very cumbersome. A simple solution for this is to separate common settings and machine-dependent settings into different files like this,
MNAME=`uname -s`
MBASHRC=$HOME/Settings/bashrc.${MNAME,,}
if [ -f $MBASHRC ]; then
    echo "==> loading $MBASHRC"
    . $MBASHRC
fi
In this way, all you need to do is to write your machine-dependent settings in the bashrc.darwin or bashrc.linux.