To get release information about your Linux distribution, look for a file in the /etc directory that contains "release" in it's name. On a Gentoo system, this is called /etc/gentoo-release. Redhat will be something like redhat-release.
localhost ~ # ls /etc/*release* /etc/gentoo-release localhost ~ # more /etc/gentoo-release Gentoo Base System version 1.6.13 localhost ~ # ls /etc/*release* /etc/gentoo-release localhost ~ # cat /etc/gentoo-release Gentoo Base System version 1.6.13
Novell have written a good article about it: Detecting Underlying Linux Distro.