Skip to content

Instantly share code, notes, and snippets.

@jodell
Created January 26, 2011 17:31
Show Gist options
  • Save jodell/797065 to your computer and use it in GitHub Desktop.
Save jodell/797065 to your computer and use it in GitHub Desktop.
simple OS check
#!/bin/bash
if [ $OSTYPE = 'linux-gnu' ]; then
if [ -f /etc/debian_version ]; then
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
echo "Debian Stuff"
elif [ -f /etc/redhat-release ]; then
DIST=`cat /etc/redhat-release |sed s/\ release.*//`
echo "Redhat Stuff"
fi
elif [ `uname` = "Darwin" ]; then
echo "Mac Stuff"
else
echo 'Unsupported OS!';
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment