Linux distro from bash script

hello ALL,

I wander, is there an easy way to get information which linux distro and its version a script runs on?

I'm looking for a function like getDistroInfo(), which would return strings like "Ubuntu7.10" or "SLES10" or "RHEL5" etc.
uname returns lots of stuff, but distro info.
/etc/issue has different formats depending on distro (which is not really convenient if you don't know the distro). Does anybody have an idea?

Thanx!
Alex

Alex, what you really want to look at is the file /etc/*-release. It has several lines describing the current Linux distro that your running (see release-files for the various distro's version of this file)

The file contains several lines containing various parts of the Name - in my case I run Ubuntu and my file is named /etc/lsb-release and contains the following 4 lines -

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.1"

the DISTRIB info should be pretty consistent across the many variants