Skip to content

Instantly share code, notes, and snippets.

@flannon
Created February 15, 2018 14:22
Show Gist options
  • Save flannon/dc8771c17cb7d389e014119813fc51cd to your computer and use it in GitHub Desktop.
Save flannon/dc8771c17cb7d389e014119813fc51cd to your computer and use it in GitHub Desktop.
How to tell if you're running RHEL or Centos
#!/bin/bash
DISTROS="rhel centos darwin"
for distro in $DISTROS; do
case $distro in
rhel) [[ ! -L /etc/redhat-release ]] && echo "dist = $distro"
;;
centos) [[ ! -L /etc/centos-release ]] && echo "dist = $distro"
;;
darwin) [[ uname == "Darwin" ]] && echo "dist = $distro"
;;
*)
echo "unknown distro"
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment