Cameron, Steve writes:
> 
> Would:
> 
>       if test "X`$path/tr --version </dev/null `" != "X--version" ; then
> 
> be better?

Something along those lines would definitely be better, but that's not
it -- a non-GNU version of tr will almost certainly not produce
``--version'' as the output from ``tr --version'', so the test doesn't
even come close to testing what it's supposed to be testing.

The current development version has a shell function that's supposed to
try to find the GNU version of a tool -- what's a good generic test for
a GNU tool?  The best I can think of is:

        ``$tool --version </dev/null'' has a return code of 0 (that
        should weed out any non-GNU versions that object to --version);
        produces output either to stdout or stderr (that eliminates
        non-GNU versions that don't object to --version and act as
        filters [e.g. awk]); and the output isn't ``--version'' (that
        eliminates non-GNU versions that end up echoing their arguments
        [e.g. expr]).

-Larry Jones

Life's a lot more fun when you're not responsible for your actions. -- Calvin

Reply via email to