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 Dec 22, 2007 8:33 AM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
>
>   frequently, i want to get the version number of a command to see if
> it's new enough for what i need, but there doesn't seem to be any
> GNU-wide standard for that.
>
>   for example, if i want to know what version of "ls" i have, i can
> do:
>
> $ ls --version
> ls (GNU coreutils) 6.9
> Copyright (C) 2007 Free Software Foundation, Inc.
> This is free software.  You may redistribute copies of it under the
> terms of
> the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Richard Stallman and David MacKenzie.
> $
>
>   well, that's useful, but if all i'm after is the version number, i
> have to run that through head, and strip the first part of the line to
> get to the value i want, which is just "6.9".
>
>   "gcc" at least supports the "-dumpversion" option:
>
> $ gcc -dumpversion
> 4.1.2
> $
>
>   is there a reason there's no single GNU-standard option that simply
> gives you that version number, so you can avoid all the head'ing and
> sed'ing to get to it?
>
> rday
> --
>
> ========================================================================
> Robert P. J. Day
> Linux Consulting, Training and Annoying Kernel Pedantry
> Waterloo, Ontario, CANADA
>
> http://crashcourse.ca
> ========================================================================

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.

Jacques B.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux