Often I want to diff the output of two COMMANDS. That is, I want to run command A, then run command B, then diff the output of both of those.

For example:

Can this be done without writing the output to a temporary file?

Answer: YES!

The trick is to use Bash's process substitution feature:

Bash changes that into: It does that ^^^ after first running the two sort commands, and sending their output to filehandles 62 and 63.

show me more!

Want to do more magic with process substitution? See the following examples: multitee is something else to look into

show me more!

There's lots of other I/O redirection tricks. [1] [2]