Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save leozhang2018/0a6c8f54ceff1515f61ae63b9531ed01 to your computer and use it in GitHub Desktop.
Save leozhang2018/0a6c8f54ceff1515f61ae63b9531ed01 to your computer and use it in GitHub Desktop.
shell check OS
initOS() {
OS=$(uname | tr '[:upper:]' '[:lower:]')
if [ -n "$DEP_OS" ]; then
echo "Using DEP_OS"
OS="$DEP_OS"
fi
case "$OS" in
darwin) OS='darwin';;
linux) OS='linux';;
freebsd) OS='freebsd';;
mingw*) OS='windows';;
msys*) OS='windows';;
*) echo "OS ${OS} is not supported by this installation script"; exit 1;;
esac
echo "OS = $OS"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment