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



Reply via email to