Skip to content

Instantly share code, notes, and snippets.

@petrozavodsky
Forked from prabirshrestha/detect-os.sh
Created August 6, 2018 19:32
Show Gist options
  • Save petrozavodsky/2a01c686e3c57c0ee097b015026348ee to your computer and use it in GitHub Desktop.
Save petrozavodsky/2a01c686e3c57c0ee097b015026348ee to your computer and use it in GitHub Desktop.
detect os in bash
#!/bin/sh
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
echo "Linux"
elif [ "$UNAME" == "Darwin" ] ; then
echo "Darwin"
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]] ; then
echo "Windows"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment