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

John Summerfield debian at herakles.homelinux.org
Sat Dec 22 23:14:16 UTC 2007


Jacques B. wrote:
> On Dec 22, 2007 8:33 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:

================================================
> 
> Not at my Linux box so can't validate this, but could you get it from
> rpm -qa | grep {command_name}?  Doesn't the rpm package name always
> contain the version number?  If so at least the format would be more
> standardized thus easier to parse.

that would be rpm -qf $(type -L ls)
the type -P serves to cater the case you don't know where it is, but 
fails of the command's not actually available (but a separate test can 
handle that0.

Mapping that that returns to what's in your docs remains a challenge.

btw if this has to work on Debian too, dpkg --search is equivalent, but 
the particulars are different.

-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)




More information about the fedora-list mailing list