Created
May 1, 2016 19:37
-
-
Save JoeyBurzynski/301a3d2bd4a838d8607357d76535330f to your computer and use it in GitHub Desktop.
Bash Scripts: Detect Operating System
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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