If you want both stdout
and stderr
, use:
( application_to_run 2>&1 ) | grep FATAL
If you want both stderr
alone, you can use:
( application_to_run 2>&1 >/dev/null ) | grep FATAL
The first sends all output destined for file handle 2 (stderr
) to file handle 1 (stdout
), then pipes that through grep
. The second does the same but also sends stdout
to the bit bucket. This will work since redirection is a positional thing. First, stderr
is redirected to the current stdout
, then stdout
is redirected to /dev/null
.