The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-18-2008
Registered User
 

Join Date: Jan 2008
Posts: 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
Reply With Quote
Forum Sponsor
  #2  
Old 08-18-2008
Registered User
 

Join Date: May 2007
Location: Lewisville, NC
Posts: 7
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0