Bash & Shell Scripting (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
How does Process Substitution `<(...)` work?
senior LevelCode ExampleSystem Design
In Simple Words:
Process substitution allows the output of a command to appear as a temporary file path (/dev/fd/63):
- Instead of creating temporary files on disk to compare outputs:
bash
# Compare the output of two commands directly:
diff <(curl -s https://api.com/v1/config) <(curl -s https://api.com/v2/config)
- Also allows reading command output in a loop without creating a subshell!