Created
March 20, 2015 22:13
-
-
Save mattfinlayson/478a82696225acba0edd to your computer and use it in GitHub Desktop.
Bash for determining OS X Version (Mavericks)
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
#!/bin/bash -x | |
DARWINOS_MAJOR=`sysctl -n kern.osrelease | cut -d . -f 1` | |
DARWINOS_MINOR=`sysctl -n kern.osrelease | cut -d . -f 2` | |
OS_X_MAJOR="10" # For context | |
OS_X_MINOR=`echo ${DARWINOS_MAJOR}-4 | bc` # Magic apple convention | |
OS_X_REVISION="${DARWINOS_MINOR}" # For completeness | |
OS_X_VERSION="${OS_X_MAJOR}.${OS_X_MINOR}.${OS_X_REVISION}" | |
if [ "${OS_X_MINOR}" -ge "10" ]; then | |
echo "Mavericks" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment