I am a fan of keeping .bashrc
as close to system default setting as possible and instead manage the shell customization
$HOME/.bash.d
I put the following script at the end of my .bashrc file to add all the $HOME/.bash.d/*.sh
scripts to the .bashrc
launch. It also allows for .sh.mac
scripts for customizing my mac workstations (don't use those anymore but keep the code around just in case I do). It also allows for a system specific script to be added for host specific customizations of bashrc by looks for a match to a $HOSTNAME.sh.host
script
if [ -d $HOME/.bash.d ]; then
for I in $HOME/.bash.d/*.sh; do
source $I
done
if [[ ${OSTYPE//[0-9.]/} == 'darwin' ]]; then
for I in $HOME/.bash.d/*.sh.mac; do
source $I
done
fi
if [ -f $HOME/.bash.d/$HOSTNAME.sh.host ]; then
. $HOME/.bash.d/$HOSTNAME.sh.host
fi
fi