I am trying to consolidate my dotfiles so I only have one set for my local OSX machine and Linux servers. I have this conditional statement, but the $(brew --prefix)
is running on linux machines even though that block shouldn't run...
SYSTEM=`uname -a | cut -d" " -f1`
# These things are system specific
if [ $SYSTEM=="Darwin" ]; then
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
for file in ~/.completion/* ; do
if [ -f "$file" ] ; then
. "$file"
fi
done
elif [ $SYSTEM=="Linux" ]; then
alias upgrade='sudo apt-get update && sudo apt-get upgrade'
# save the IP address in case I need it later
export IP_ADDRESS=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
fi
if I echo the $SYSTEM
variable on the linux machine it says it is Linux
but sourcing of the bashrc fails on the brew --prefix
command.
Does it evaluate that variable no matter what? Is there a way I can change it to work?