Skip to content

Instantly share code, notes, and snippets.

@rajubudde
Forked from prabirshrestha/detect-os.sh
Created December 6, 2019 14:44
Show Gist options
  • Select an option

  • Save rajubudde/d251708a79eb88094ca336d1d7b7680d to your computer and use it in GitHub Desktop.

Select an option

Save rajubudde/d251708a79eb88094ca336d1d7b7680d 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