Created
November 30, 2016 12:20
-
-
Save n1mh/d4835174325ca13b41b497aecce5a917 to your computer and use it in GitHub Desktop.
getting linux distro
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 | |
if [ "${OS}" = "Linux" ] ; then | |
KERNEL=`uname -r` | |
elif [ -f /etc/redhat-release ] ; then | |
DIST='RedHat' | |
PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` | |
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` | |
elif [ -f /etc/SuSE-release ] ; then | |
DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` | |
REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` | |
elif [ -f /etc/mandrake-release ] ; then | |
DIST='Mandrake' | |
PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` | |
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` | |
elif [ -f /etc/debian_version ] ; then | |
DIST="Debian `cat /etc/debian_version`" | |
REV="" | |
fi | |
echo "Distro: $DIST" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment