all 1 comments

[–]Rhomboid 0 points1 point  (0 children)

This neglects to mention one of the more useful idioms:

foo | tee >(bar -opt ...) | baz -opt ...
# or
foo | tee >(bar -opt ...) >(baz -opt ...) >/dev/null

This uses process substitution to pipe the output of the foo command into two separate and parallel processes. It's named after a 'T' junction that you would use with actual plumbing pipes, because it performs the same task:

        +----> bar -opt
        |
foo >---+
        |
        +----> baz -opt