What does <() do in Bash? What does <() do in Bash? bash bash

What does <() do in Bash?


This is called process substitution.

<(list) is a single syntax construct, the '<' character is not a separate symbol in this case. It executes list and provides its output as sort of a file (not a standard redirection) to the command.

It is equivalent to running (except it uses pipes instead of temporary files when possible):

sort abc > /tmp/1sort bcd > /tmp/2join /tmp/1 /tmp/2

Note that the output of both sorts are provided as filenames to join, not as standard redirections.

(list) is a different construct, for a different purpose. It simply creates a subshell that executes list, providing its standard descriptors to the parent shell.

Here is the relevant part in the bash manual.


<(command) is a Process Substitution (see the according section in man bash). Basically command is run and its output is fed to a named pipe (FIFO), and the whole construct is then replaced by the name of the pipe, thus resulting in join /dev/fd/x /dev/fd/y.