What is process substitution in bash?
Why Interviewers Ask This
Advanced questions like this reveal whether a candidate has internalized Linux / Shell Scripting deeply enough to make architectural decisions. Strong answers demonstrate both breadth and depth of experience.
Answer
Process substitution lets you use the output of a command as if it were a file. Syntax: <(command) (output as file) or >(command) (input as file). The shell creates a named pipe or /dev/fd/N entry. Example: diff <(sort file1) <(sort file2) — diffs the sorted versions without creating temp files. comm <(sort a.txt) <(sort b.txt). Paste columns: paste <(cut -d: -f1 /etc/passwd) <(cut -d: -f6 /etc/passwd). Unlike command substitution ($()), process substitution doesn't capture output — it provides a file descriptor. It runs asynchronously, so be careful with exit codes — the substituted process's exit code is not captured by $?.
Common Mistake
Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your Linux / Shell Scripting experience.