title: Using a bash script to grep an integer and compare it to another
body: <p>I have a bash script to copy files from one location to another if the score within the file is less than 36. </p>
  
  <p>I run this script once a month, and it worked before but now I'm getting the error: </p>
  
  <pre><code>line 5: [: -lt: unary operator expected
  </code></pre>
  
  <p>Here is the script: </p>
  
  <pre><code>#!/bin/bash
  for f in `ls $1/*.html`
  do
          score=`grep -o -P '(?&lt;=ADJ. SCORE: )-?[0-9]?[0-9]' $f`
          if [ $score -lt 36 ]
                  then cp $f $2
          fi
  done
  </code></pre>
  
  <p>I'm not sure if the OS matters; I'm using OS X 10.7 and I've troubles in the past with my bash scripts that otherwise work great on Linux boxes. </p>
  
  <p>Thanks in advance!</p>