is there a standard for getting a command's version number?
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
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
12-22-2007, 12:52 PM
Karl Larsen
is there a standard for getting a command's version number?
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
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
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
12-22-2007, 01:19 PM
Peter Lauri
is there a standard for getting a command's version number?
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.
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@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
12-22-2007, 01:47 PM
"Jacques B."
is there a standard for getting a command's version number?
On Dec 22, 2007 8:33 AM, Robert P. J. Day <rpjday@crashcourse.ca> 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.
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
12-22-2007, 02:01 PM
"Robert P. J. Day"
is there a standard for getting a command's version number?
On Sat, 22 Dec 2007, Jacques B. 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.
but the command name doesn't necessarily need to match the package
name from whence it came, as in:
$ rpm -qf /bin/ls
coreutils-6.9-12.fc8
obviously, this isn't a life-or-death issue but, given the frequency
with which people might want to check the version number of a command,
i am a bit surprised that there's no GNU-wide standard option
(--exactversion?) that just gives it to you.
did no one ever suggest such a thing? just curious.
rday
p.s. one option is to just use rpm and queryformat, as in:
or something to that effect.
--
================================================== ======================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
12-22-2007, 10:14 PM
John Summerfield
is there a standard for getting a command's version number?
Jacques B. wrote:
On Dec 22, 2007 8:33 AM, Robert P. J. Day <rpjday@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.