title: bash - check if string variable equals form feed
body: <p>I am new to bash, so this is likely simply answered, but my research has yet to garner me a solution. I am trying to write a simple bash script that checks if a pdf needs to be OCR'd. It uses the <code>pdftotext</code> executable distributed with Xpdf. If <code>pdftotext</code> doesn't output any text, then the PDF needs to be OCR'd. The problem is, if a PDF hasn't been OCR'd, <code>pdftotext</code> returns a Form Feed character (not simply an empty string). Try as I might, I can't get bash to compare the string returned from <code>pdftotext</code> with the form feed. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>pdf_txt=$(pdftotext -q -l 5 '/Path/to/pdf/test.pdf' -)
  if [ "$pdf_txt" = "\f" ]
  then
      echo 'needs ocr'
  else
      echo "doesn't need ocr"
  fi
  </code></pre>
  
  <p>Now, <code>test.pdf</code> has not been OCR'd. If I run this test in Python and use <code>repr()</code> I get <code>\x0c</code>, the character code for the form feed. But <code>echo</code>ing <code>$pdf_txt</code> in bash just prints the blank line.</p>
  
  <p>Thoughts? Suggestions?</p>