Skip to content

Instantly share code, notes, and snippets.

@JoeyBurzynski
Created May 1, 2016 19:37
Show Gist options
  • Save JoeyBurzynski/301a3d2bd4a838d8607357d76535330f to your computer and use it in GitHub Desktop.
Save JoeyBurzynski/301a3d2bd4a838d8607357d76535330f to your computer and use it in GitHub Desktop.
Bash Scripts: Detect Operating System
#!/usr/bin/env bash
if [ "$(uname)" == "Darwin" ]; then
# Do something under Mac OS X platform
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# Do something under GNU/Linux platform
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
# Do something under Windows NT platform
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment