Subject: bug#6020: coreutils-8.x: a simple feature enhancement, and how to do it

From: Jim Meyering <[email-masked]>
Date: Thu, 29 Apr 2010 11:04:50 +0200

Pádraig Brady wrote:
> On 29/04/10 07:26, Erik Auerswald wrote:
>> Hi,
>>
>> two nit-picks regarding the test script below:
>>
>> On Thu, Apr 29, 2010 at 12:39:46AM +0100, Pádraig Brady wrote:
>>> [...]
>>> @@ -0,0 +1,51 @@
>>> +#!/bin/sh
>>> +# Ensure sort -g sorts floating point limits correctly
>>> [...]
>>> +if test "$VERBOSE" = yes; then
>>> +  set -x
>>> +  mv --version
>>      ^^
>>      sort
>> would be nicer.
>
> Heh, I noticed that :)
>
>>> +# See if sort should be using long doubles
>>> +grep '^#define HAVE_C99_STRTOLD 1' $CONFIG_HEADER > /dev/null ||
>>                                                      ^^^^^^^^^^^
>>                                                      -q
>> would be more concise.
>
> and efficient (it exits on first match).

When efficiency is important, sometimes I've used -l. (e.g., in maint.mk)
That is portable and also makes grep stop searching upon first match.
However, you'd probably still want to redirect its stdout.
Useful when grep would otherwise search much more or
generate much more output.

> However, even though POSIX specifies -q, it's not portable.
> Solaris' grep for example, does not support -q.
> We'll start using it at some stage though.
>
> My latest patch is attached which corrects the info docs
> to mention strtold() not strtod().

Thanks for writing that.