The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 128 6 Days Ago 08:28 AM
help newb at linux and bash need numeric script sort dlm1065 Shell Programming and Scripting 1 04-27-2008 04:11 AM
Copying a Linux distro from one partition to the other... Mr_Proper UNIX for Advanced & Expert Users 5 06-18-2003 01:38 PM
Linux distro wolk UNIX for Dummies Questions & Answers 4 11-29-2002 08:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-18-2008
Samtim74 Samtim74 is offline
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
  #2 (permalink)  
Old 08-19-2008
reharpernc reharpernc is offline
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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0