~/bin/path-version -latest -verbose --version -print -exec bash -c 'echo hi from bash $($SHELL -version)'
/home/glew/bin/bash: 3.2.25(1)-release
/usr/local/bin/bash: 2.05a.0(2)-release
/bin/bash: 3.2.25(1)-release
latest: /home/glew/bin/bash: 3.2.25(1)-release
exec /home/glew/bin/bash, -c echo hi from bash $($SHELL -version);
hello /bin/bash -c echo hi from bash $($SHELL -version)
hi from bash GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc.
--version (or -v, or -V, or -version) is the knob passed to the tool to query its version.
you can print all version, just the most recent, or just exec.
--
Based on a Perl library I just wrote, Version_Numbers.pm, that parses Version number strings of several syntaxes. I.e. not just Perl's, and not just 1.2.3
I was surprised not to find such a library already existing. Some were close, but not quite there.
I was surprised not to find such a library already existing. Some were close, but not quite there.
Also compares. Although the comparison rules are a it two simplistic: strings are lexically sorted, whereas possibly
1.2rc should be less recent than 1.2, if the latter is what actually got released.