title: How to fix ' [: missing `]' ' error in Bash script?
body: <p>I'm trying to write a script.</p>
  
  <p>This is part of my code</p>
  
  <pre><code>if [ #? -ne 0 ]
  then
      echo "Args:"
  
      if [ -r $word.args ]
      then
          cat $word.args
      fi
  
      echo "Expected:"
      cat $word.out
      echo "Actual:"
      cat $tempfile
  fi
  </code></pre>
  
  <p>When I run some test, it always shows that " [: missing `]' "
  at this line </p>
  
  <pre><code>if [ #? -ne 0 ]
  </code></pre>
  
  <p>Why?</p>