Subject: bug#63819: Gnu `grep '.*'` does not match an empty string.

From: "Bob Vincent Il (US)" <[email-masked]>
Date: Thu, 1 Jun 2023 02:17:07 +0000

Okay, but `echo ''` does not output an empty string. It outputs a line feed character.

Bob Vincent (US-TSO)

PwC IT - NGC - PUPPET DEV OPS | Senior Manager
Work: 906-984-3549
Mobile: 770-744-1792
PricewaterhouseCoopers LLP
________________________________
From: Paul Eggert <[email-masked]>
Sent: Wednesday, May 31, 2023 8:42:47 PM
To: Bob Vincent Il (US) <[email-masked]>
Cc: [email-masked] <[email-masked]>
Subject: Re: bug#63819: Gnu `grep '.*'` does not match an empty string.

On 2023-05-31 10:18, Bob Vincent Il (US) via Bug reports for GNU grep wrote:
> I discovered only today that the following commands all behave identically:
>
>    *   grep -q '.*'
>    *   grep -q '.\+'
>    *   grep -q .
>    *   grep -qE '.*'
>    *   grep -qE '.+'
>    *   grep -qE .

No they don't. For example:

$ echo '' | grep -q . ; echo $?
1
$ echo '' | grep -q '.*' ; echo $?
0

________________________________

The information transmitted, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited, and all liability arising therefrom is disclaimed. If you received this in error, please contact the sender and delete the material from any computer.

In the event the content of this email includes Tax advice, the content of this email is limited to the matters specifically addressed herein and is not intended to address other potential tax consequences or the potential application of tax penalties to this or any other matter.

PricewaterhouseCoopers LLP is a Delaware limited liability partnership. This communication may come from PricewaterhouseCoopers LLP or one of its subsidiaries.

________________________________