Bash Process Substitution
Process Substitutions
To use the output of a command as a file, use process subsitution.
To provide a command as an input file to another command, try:
cat <(date)
This grammar becomes more useful when multiple commands are used for input.
cat <(date) <(date) <(date)
To provide a command as an output file to another command, try:
curl --output >(cat) www.example.com
Redirection
Like any other file, a process substitution can be redirected into a command.
cat < <(date)
For the most part, this is equivalent to using a pipeline. The STDOUT of commanda is piped into the STDIN of cat(1). The difference is that multiple commands can be piped in.
Similarly, output can be redirected into a process substitution.
date > >(cat)
Again, this is generally equivalent to using a pipeline. The difference is that STDOUT and STDERR can be redirected separately.
date > >(cat) 2> >(cat)