Created
November 21, 2012 16:29
-
-
Save bermi/4125858 to your computer and use it in GitHub Desktop.
Bash simple operating system detection
This file contains hidden or 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
#!/bin/bash | |
os=${OSTYPE//[0-9.-]*/} | |
case "$os" in | |
darwin) | |
echo "I'm a Mac" | |
;; | |
msys) | |
echo "I'm Windows using git bash" | |
;; | |
linux) | |
echo "I'm Linux" | |
;; | |
*) | |
echo "Unknown Operating system $OSTYPE" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment