bug-grep
[Top][All Lists]
Advanced

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

bug#69929: Can grep -q report matches in incomplete lines?


From: Niels Möller
Subject: bug#69929: Can grep -q report matches in incomplete lines?
Date: Thu, 21 Mar 2024 16:02:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Niels Möller <nisse@lysator.liu.se> writes:

> E.g., if I run 
>
>   (printf foo ; sleep 30) | grep -q foo
>
> I want grep to exit successfully right away. Currently, grep waits until
> it gets EOF on the input, 30 seconds later.

Sorry if I'm confused about how to script this. The following (bash
syntax) is a better example:

  grep -q foo <(sh -c 'printf foo ; sleep 30' &)

This blocks 30 seconds before exiting. In contrast, 

  grep -q foo <(sh -c echo foo ; sleep 30' &)

(only difference is the newline at the end of the line) does exit
immediately.

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]