Created
February 15, 2018 14:22
-
-
Save flannon/dc8771c17cb7d389e014119813fc51cd to your computer and use it in GitHub Desktop.
How to tell if you're running RHEL or Centos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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