SHARE
TWEET

Nels Nelson

a guest Feb 20th, 2009 33 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. [ -a /etc/*-release ] && grep -q "Ubuntu" /etc/*-release   && os="ubuntu";
  4. [ -a /etc/*-release ] && grep -q "Red Hat" /etc/*-release  && os="redhat";
  5. [ -a /etc/issue ] && grep -q "Debian" /etc/issue           && os="debian";
  6. [ ! -z $(which uname) ] && uname -a | grep -q "Darwin"     && os="darwin";
  7.  
  8. case "${os}" in
  9.      darwin ) echo "Darwin!";;
  10.      ubuntu ) echo "Ubuntu!";;
  11.      debian ) echo "Debian!";;
  12.      redhat ) echo "Red Hat!";;
  13.           * ) echo "You're dumb and your computer hates you!";;
  14. esac
RAW Paste Data
Top