I want to check wether the output of my command contains "rerun" (and then rerun) but I also want to display the whole output. I know that I could use one of these:
command | tee >(grep rerun)
command | grep rerun
The first one prints the whole output as expected, but I can't use it as a condition because it always returns 0. The second one only prints the lines that contain rerun, but it returns 1 if there's no match.
My usage example:
while pdflatex paper.tex | grep -E "rerun LaTeX|run Biber"; do
biber paper
done
The answers provided here also don't help because there grep always returns 0.
command | tee >(echo) | grep rerun
but that doesn't give any output as well.