Member-only story
Process Substitution: The Bash Feature That Kills Temp Files
Subtitle: Compare command output, connect multiple tools, and avoid temporary files using Bash’s powerful <() and >() syntax.
You need to compare the output of two commands. Normally, you might save both outputs into temporary files and then run diff.
It works, but now you have files to create, manage, and delete.
What if Bash could pass command output directly to another command as if it were a file?
It can. The feature is called process substitution, and it can make shell scripts shorter, cleaner, and easier to maintain.
1. What Is Process Substitution?
Process substitution is a Bash feature that allows the output or input of a command to be accessed through a filename-like interface.
It uses two forms:
<(command)
>(command)They look similar, but they do different jobs.
For example:
diff <(command1) <(command2)Instead of creating two temporary files, Bash gives diff two file-like paths that provide the output of the commands.
And:
tee >(gzip > output.gz)







