Maybe this links could help you :)
Switching To Ubuntu From Linux RedHat Enterprise Linux And Fedora
Differences Between Red Hat-style and Debian-style Distributions
Unfortunately, there is no surefire, simple way of getting the distribution name. Most major distros are moving towards a system where they use to store this information. Most modern distributions also include the /etc/os-release tools but these are not always installed by default. So, here are some approaches you can use:lsb_release
Use /etc/os-release
awk -F= '/^NAME/{print $2}' /etc/os-release
Use the tools if availablelsb_release
lsb_release -d | awk -F"\t" '{print $2}'
Use a more complex script that should work for the great majority of distros:
# Determine OS platform
UNAME=$(uname | tr "[:upper:]" "[:lower:]")
# If Linux, try to determine specific distribution
if [ "$UNAME" == "linux" ]; then
# If available, use LSB to identify distribution
if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then
export DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//)
# Otherwise, use release info file
else
export DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
fi
fi
# For everything else (or if above failed), just use generic identifier
[ "$DISTRO" == "" ] && export DISTRO=$UNAME
unset UNAME
Parse the version info of if installed:gcc
CentOS 5.x
$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
CentOS 6.x
$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
Ubuntu 12.04
$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
Ubuntu 14.04
$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This has basically been directly copied from @slm's great answer to my question here.