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

Robert P. J. Day rpjday at crashcourse.ca
Sat Dec 22 13:33:30 UTC 2007


  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
========================================================================




More information about the fedora-list mailing list