Created
April 24, 2017 12:55
-
-
Save ltpitt/e6933ab06a8940c22f17d647ae52a331 to your computer and use it in GitHub Desktop.
Function to check Distribution and Version of *nix Operating Systems
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
# OS check function | |
os_check () | |
{ | |
OS=`uname -rs` | |
if [ "`uname -rs | grep 'Linux 2.6.9'`" ] | |
then | |
OS=RHEL_4 | |
elif [ "`uname -rs | grep 'Linux 2.6.18'`" ] | |
then | |
OS=RHEL_5 | |
elif [ "`uname -rs | grep 'Linux 2.6.32'`" ] | |
then | |
OS=RHEL_6 | |
elif [ "`uname -rs | grep 'SunOS 5.8'`" ] | |
then | |
OS=Sol_8 | |
elif [ "`uname -rs | grep 'SunOS 5.9'`" ] | |
then | |
OS=Sol_9 | |
elif [ "`uname -rs | grep 'SunOS 5.10'`" ] | |
then | |
OS=Sol_10 | |
else | |
echo "OS cannot be identified, exiting..." | |
exit 1 | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment