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

Karl Larsen k5di at zianet.com
Sat Dec 22 13:52:44 UTC 2007


Robert P. J. Day 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
> ========================================================================
>
>   
    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


-- 

	Karl F. Larsen, AKA K5DI
	Linux User
	#450462   http://counter.li.org.
   PGP 7025 BB6C 7CC3 CFE7 43B2  1574 3279 EBB0 B626 2B7E




More information about the fedora-list mailing list