[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#871835: auto detect grep options



On Fri, 2017-09-22 at 12:56 +0200, Thomas Lange wrote:
> Here's the patch that automatically detects if grep supports the Perl
> regex.
[...]
> +	set +e

You don't need to turn off errexit if you test the result of a command.

> +	if grep -q --perl-regexp . /dev/null >/dev/null 2>&1; then
> +	    gropt=-E
> +        else
> +	    gropt=-P
> +	fi
[...]

This seems to be the wrong way round.  Besides which, if we check for
--perl-regexp, then we ought to pass that and not assume -P means the
same thing.

Ben.

-- 
Ben Hutchings
Horngren's Observation:
              Among economists, the real world is often a special case.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: