Dup Ver Goto 📝

ProcessSubstitution

PT2/aw/os/shell does not exist
To
20 lines, 100 words, 611 chars Page 'ProcessSubstitution' does not exist.

Process substitution is written using parentheses and behind the scenes uses named pipes.

Example 1

cat <(ls) <(echo hello)

This takes the command ls and sends its output to a named pipe (say pipe_a), does similar with the echo command, to say pipe_b, and then runs cat as

cat pipe_a pipe_b

The actual pipe filenames will look something like

/dev/fd/11

as you can verify by running e.g.

echo <(ls)

Note that this does //not// use stdin, and requires that the command (here cat) reads from files specified on the command line.