title: How can you diff two pipelines in Bash?
body: <p>How can you <a href="http://en.wikipedia.org/wiki/Diff" rel="noreferrer">diff</a> two pipelines without using temporary files in Bash?  Say you have two command pipelines:</p>
  
  <pre><code>foo | bar
  baz | quux
  </code></pre>
  
  <p>And you want to find the <code>diff</code> in their outputs.  One solution would obviously be to:</p>
  
  <pre><code>foo | bar &gt; /tmp/a
  baz | quux &gt; /tmp/b
  diff /tmp/a /tmp/b
  </code></pre>
  
  <p>Is it possible to do so without the use of temporary files in Bash?  You can get rid of one temporary file by piping in one of the pipelines to diff:</p>
  
  <pre><code>foo | bar &gt; /tmp/a
  baz | quux | diff /tmp/a -
  </code></pre>
  
  <p>But you can't pipe both pipelines into diff simultaneously (not in any obvious manner, at least).  Is there some clever trick involving <code>/dev/fd</code> to do this without using temporary files?</p>