title: Unary operator expected in shell script
body: <p>I am not sure why my code below generates this error <code>(standard_in) 1: syntax error -bash: [: -eq: unary operator expected </code>. Can someone please help me figure out the problem here? Thanks!</p>
  <pre><code>#!/bin/bash    
  BAMLINES=4.47264e+09
  FQ1LINES=4000000
  FQ2LINES=4000000
  DEBUG=1
  
  if [ ! -z ${DEBUG} ]; then
  echo &quot;${BAMLINES} lines in .bam&quot;
  echo &quot;${FQ1LINES} lines in all ${FQ_OUT1} files&quot;
  echo &quot;${FQ2LINES} lines in all ${FQ_OUT2} files&quot;
  
  if [ $(echo &quot;scale=2;${FQ1LINES}/${BAMLINES} &gt; 0.40&quot; | bc) -eq 0 ]; then
      echo &quot;Warning, FQ1 file contains ${FQ1LINES} lines - less than 40% of the number of reads of .bam file&quot;
    fi
  if [ $(echo &quot;scale=2;${FQ2LINES}/${BAMLINES} &gt; 0.4&quot; | bc) -eq 0 ]; then
      echo &quot;Warning, FQ2 file contains ${FQ2LINES} lines - less than 40% of the number of reads of .bam file&quot;
    fi  
  fi
  </code></pre>