title: Checking diff exit status in a script
body: <p>On the command line, after using diff on two files that differ, the command   </p>
  
  <pre><code>echo $?   
  </code></pre>
  
  <p>reports back '1'.  When I try the same in a script, as follows:   </p>
  
  <pre><code>echo "` diff $F1 $F2`"   
  rv=$?  
  if [[ $rv == 1 ]]  
  then    
      echo "failed"    
  fi        
  </code></pre>
  
  <p>then I never print 'failed' (even for differing files). Note that this is the bash shell, so the grammar should be fine (eg, if I check for '0' instead, it always prints).  </p>
  
  <p>How can I check if the diff command discovered differences, and process conditionally on that?    </p>
  
  <p>This is under Ubuntu 12.04.</p>