title: Trying to find if a remote file contains a string in an expect script
body: <p>I have an expect script in which I need to know if a remote box has a string. </p>
  
  <p>I have the below command in my expect script to achieve that: </p>
  
  <pre><code>set status [catch {exec ssh gn@cm1 "grep -c 'End of Test' /bf/tcl/tcl_scripts/log"} result]
  </code></pre>
  
  <p>But when the <em>grep</em> command, cannot find the string it returns an error status (1) to exec, which I am handling using the <em>catch</em>. But after this command all expect commands (send, expect etc) stop working. </p>
  
  <p>How do I get around this problem?</p>