On 3/21/24 06:57, Niels Möller wrote:
I'm having grep -q read input from a pipe. I would like grep to exit
successfully as soon as a match occurs, without requiring the line to be
terminated by newline or EOF (unless the grep pattern includes '$', that
is).
Grep used to behave almost that way. It did wait for a newline but it
did not wait for EOF. But people started complaining about that behavior
so we changed it.
Perhaps there should be an option to switch between old and new behaviors.
However, not waiting for a newline is problematic; although doable it
would be a bit of a pain to program and not sure it's worth the effort.
Grep didn't used to do that.