I need to do two separate things with the standard output stream of my program: Say, direct it into two pipes, or print it to the terminal and direct it into a pipe. But - none of these things is directing it into a file.
If I wanted a pipe + a file, I would use the tee
command: myprog | tee out.txt | another_command
, as explained here. But what if none of the two actions are writing to a file?
You can use process substitution in bash
to do that. Say you want to redirect output from myprog
to two separate entities to read on, use the >(..)
along with tee
myprog | tee >(prog1) >(prog2)
See Greg's Wiki or the man bash docs for more information.