title: Conditional check in a shell
body: <p>I have a python script <code>p.py</code> which does <code>exit("ABC")</code> for some files. I would like to write a Ubuntu shell to copy the files which make the script <code>exit("ABC")</code> into a folder:</p>
  
  <pre><code>#!/bin/bash
  
  FILES=*.txt
  TOOL=p.py
  TAREGT=../TARGET/
  
  for f in $FILES
  do
      if [ $(python $TOOL $f) = "ABC" ]
      then
          echo "$f"
          cp $f $TARGET
      fi
  done
  </code></pre>
  
  <p>but the condition check <code>if [ $(python $TOOL $f) = "ABC" ]</code> does not seem to work, it says <code>./filter.sh: line 13: [: =: unary operator expected</code>. Could anyone tell me what is wrong? </p>