title: How to: compare command output to text file with bash
body: <p>I'm trying to compare the output of the command</p>
  
  <pre><code>`ls -l directory` 
  </code></pre>
  
  <p>with a file that I've created using the same command. (I'm trying a poor man's way of making sure no files have been modified.)</p>
  
  <p>The trouble is, I don't know how to <code>diff</code> the output of the <code>ls</code> command with the file that I've created. I've tried the following and each time it doesn't work</p>
  
  <pre><code>diff file.ls &lt;(ls -l directory)
  ls -l directory | xargs diff file.ls
  ls -l directory | diff file.ls
  diff file.ls &lt; `ls -l directory`
  </code></pre>
  
  <p>What is the magic command to compare the output of <code>ls</code> to a file that I've already saved?</p>