freelanceprogrammers.org Forum Index » Perl

Parsing out kernel release from /bin/uname command


View user's profile Post To page top
polaris42002 Posted: Thu Sep 08, 2005 5:31 am


Joined: 08 Sep 2005

Posts: 1
Parsing out kernel release from /bin/uname command
Hello,

I`m looking for a tried and true module for parsing the output of the
uname command but have not been able to find one. My goal is to parse
out the full kernel release from the command.

If I run `uname` with the -r(release) option, I get:

$ uname --kernel-release
2.6.5-1.358smp

But that is not the entire release info--the rest is appended to the
version:

$ uname --kernel-version
#1 SMP Sat May 8 09:25:36 EDT 2004

So the full release string should be `2.6.5-1.358smp #1 SMP`.

I think I can put together a hack using `Date::Parse::str2time()` to
recognize the date info in version, take that out and then concat the
release info to what`s left, but I`d rather not if it`s been done
before. It`s hard to believe that there isn`t a module out there for
this...so please let me know if there is or if you see a more elegant
solution to this problem.

Thanks all
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help