![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is your favorite Linux distro? | milhan | Linux | 117 | 7 Hours Ago 11:01 PM |
| help newb at linux and bash need numeric script sort | dlm1065 | Shell Programming and Scripting | 1 | 04-27-2008 01:11 AM |
| Copying a Linux distro from one partition to the other... | Mr_Proper | UNIX for Advanced & Expert Users | 5 | 06-18-2003 10:38 AM |
| Linux distro | wolk | UNIX for Dummies Questions & Answers | 4 | 11-29-2002 05:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |