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

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected