When trying to filter very long output from make for specific warnings or error messages, the first idea would be something like this:
$ make | grep -i 'warning: someone set up us the bomb'
The result is not fully satisfying, though. The output will not just contain the filter results from grep
but also stdout
and stderr
messages from other tools that are used in the make
target somewhere.
The question now is:
To answer the questions:
stdout
of make
to the stdin
of grep. make
's stderr
is still connected to the terminal in will therefore be printed without filtering.The solution is connect make
's stderr
to its stdin
and ignore the stdin
$ make 2>&1 >/dev/null | grep -i 'warning: someone set up us the bomb'
This only prints the output of grep, but nothing from make or other tools like rm
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With