Now this actually does not work, because it believes that I grepping myprocess.exe > output.log instead of myprocess.exe
Wrong. Everything should be fine. In the first example, the pipeline runs with stdout installed on your terminal (this way you see the output, but nothing is written to the file). The second example runs the pipeline with stdout set to output.log (this way you don't see the output, but it will go directly to your file).
If you want the result to be written for both, you need another process that gets your previous stdout pipeline as stdin and duplicates it. How:
previous_pipeline | tee output.log
tee will print on stdout what it gets on stdin (So ββfor stdout , everything is the same as before), but additionally open another file (specified as cmdline arg) and write a copy to it.
Jo so source share