## diff two commands

by on Jan.17, 2011, under Programming, scripting

Ran across this problem with a friend today. How does one diff the output of two commands without first dumping the output of the two commands to files? I found a solution that seems to work:

``` diff <(command1) <(command 2) ```

Suppose we wanted to diff the contents of two directories:

``` diff <(ls directory1) <(ls directory2) ```