Subject: bug#78891: Option to make grep always exit with 0

From: Martin Schulte <[email-masked]>
Date: Wed, 25 Jun 2025 08:09:43 +0200

Hello Thomas!

> echo -e "foo\nbar" | { grep '^#' >comments.txt || true; } |
> some-other-command
> 
> Related: My Bash Strict Mode. Handle non-zero exit codes
> <https://github.com/guettli/bash-strict-mode/blob/main/README.md#bash-strict-mode-handle-non-zero-exit-codes>
> 
> This works, but it is not nice to read and more typing.

What about a

grep_always_true() {
  grep "$@" || true
}

?

Best regards,

Martin