Skip to content

Instantly share code, notes, and snippets.

@devopsmariocom
Last active December 17, 2015 12:09
Show Gist options
  • Save devopsmariocom/5607945 to your computer and use it in GitHub Desktop.
Save devopsmariocom/5607945 to your computer and use it in GitHub Desktop.
Os Detection Script
#!/bin/bash
# Assume unknown
dtype="unknown"
# First try use lsb_release if exists
if hash lsb_release 2>/dev/null; then
dtype=`lsb_release -is`
# Last but not least try OS X
elif [ $(uname -s) == "Darwin" ]; then
dtype="Darwin"
fi
echo $dtype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment