OS Specific Bash Aliases Or Configs Using Conditions

Posted by Weston Ganger

I usually keep all of my dotfiles in a repo and share them across all of my machine. So when I had a couple of Bash alias’ that were not working and environment variables that were different on my Macbook it was becoming a bit annoying.

So I started using OS conditionals inside my .bash_aliases and .bashrc files


if [[ $(echo $OSTYPE) == "linux-gnu" ]]; then
  # Linux
elif [[ $(echo $OSTYPE) == "darwin"* ]]; then
  # Mac OSX
fi


Related External Links:

Article Topic:Software Development - Linux

Date:December 21, 2015

Recommended Posts