This one's been bugging me for a while now. Is it possible to redirect stdout
and stderr
to both the terminal output and to a program?
I understand it's possible to redirect the outputs to a file and to stdout
with tee
, but I want it to go to a program (my editor [TextMate]) as well as to the terminal output… surely this is possible (I know its possible with zsh…)
You can use a named pipe, which is intended for exactly the situation you describe.
mkfifo some_pipe command_that_writes_to_stdout | tee some_pipe \ & command_that_reads_from_stdin < some_pipe rm some_pipe
Or, in Bash:
command_that_writes_to_stdout | tee >(command_that_reads_from_stdin)
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