1

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?

einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

6

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.

Inian
  • 80,270
  • 14
  • 142
  • 161