Skip to content
The Bash Insectarium

/static/insetario/en/inseto/proc-substituicao/

Menu

BSH-015 · Processes

<(comando)

A command's output dressed as a file — without touching the disk.

Process substitution hands over a command where a file is expected: <(cmd) becomes a name — /dev/fd/63 — that, when read, delivers the command's output. A diff between two outputs needs no temporary files.

The twin >(cmd) points the other way: whatever is written to the name feeds the command's input — tee >(gzip > log.gz) stores compressed while showing on screen.

$ diff <(sort ninho-a.txt) <(sort ninho-b.txt)
2c2
< besouro
---
> cigarra
Two outputs compared with no file in between.