Re: is there a standard for getting a command's version number?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2007-12-22 at 06:52 -0700, Karl Larsen wrote:
>     It is seldom I need the version of software. But when I do it
> seems 
> that --version works all the time. The results are more than you
> wanted 
> but who cares?
> 
> Karl

I assume he he building some automated check to verify version numbers
etc, so he want to avoid having to make special cases (different
parsing) for every single software he is verifying.

You could create a wrapping perl script that is taking the "software" as
an input parameter and then according to a config file (or a hash inside
of the perl script) that will give you the answer you want.

ls.command=ls --version
ls.regexp=ls[^\d]+(\d+\.\d+\S+)\s*
gcc.command=gcc -dumpversion
gcc.regexp=^(\d+\.\d+\S+)\s*

Create a hash based on this, preform a 

if($hash{$software}{'command'} =~ /$hash{$software}{'regexp'}/) {
  print $1;
}

If you aren't familiar with Perl programming, I can create the script
for you, it is a quick task.

/Peter


-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux