Frequently Asked Question
What is process substitution and how does <(...) differ from a pipe?
Process substitution, written <(cmd) or >(cmd), lets you treat the output (or
input) of a command as if it were a regular file. Under the hood bash creates a
pipe, starts cmd connected to one end, and substitutes a path like
/dev/fd/63 into the command line where you wrote <(cmd). The outer program
opens that path and reads or writes through it, never knowing there's another
process on the other side.
The killer use case is commands that take file arguments, not stdin, things
like diff, comm, or paste. With a pipe you can only feed one of them; with
process substitution you can feed any number: diff <(sort file1) <(sort file2)
runs both sorts in parallel and compares their outputs without ever creating
temporary files. The output form >(cmd) is symmetric: `cmd1 | tee >(cmd2)
(cmd3)` sends one stream to two consumers in parallel. It is bash and zsh; not POSIX, and not in dash.