title: Check the output of a command in shell script
body: <p>I'm writing a very simple shell scripts that would looked at the log of all failed tests, and print out all the name of all files in the current directory that are in the log</p>
  
  <pre><code> 1  #! /bin/sh
  
   2  for file in *
   3  do
   4      echo "checking: $file"
   5      if [$(grep $file failed.txt -c) -ne 0]
   6      then
   7          echo "$file FAILED"
   8      fi
   9  done
  </code></pre>
  
  <p>When I execute it, I get this error:</p>
  
  <pre><code>line 6: [0: command not found
  </code></pre>
  
  <p>Does anyone have any idea why?</p>
  
  <p>Thanks!!</p>