title: Unix Shell Scripting - Loop until files are not found
body: <p>I am writing shell script. I need to check specific directory for files existence with 2 specific file extension "eob" and "inp", and if exists I want to stay in the loop and keep on checking until files do not exist, then I want to break from my loop and proceed with the rest of the logic.</p>
  
  <p>Below is the code I have so far, but it is not working...</p>
  
  <pre><code>while true
  do
    [ ! find /home/mpcmi/cm -type f \( -name "*.eob" -o -name "*.inp" \) ] &amp;&amp; break
    echo "eob or inp file exists"
    sleep 2
  done
  echo "eob or inp file doesn't exists" 
  </code></pre>
  
  <p>First, I am getting this error when running the script:</p>
  
  <pre><code>"/home/mpcmi/cm: unknown test operator"
  </code></pre>
  
  <p>Second, it checks and finds the files with these extensions correctly I suppose because I am getting the output: "eob or inp file exists" however when I delete my test "eob" and "inp" files the script doesn't seem to detect it, it stops printing "eob or inp file exists" but it never prints "eob or inp file doesn't exists" </p>
  
  <p>Below is the entire output, then it just stops after I delete test "eob" and "inp" files:</p>
  
  <pre><code>employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  employees_load.sh[9]: /home/mpcmi/cm: unknown test operator
  eob or inp file exists
  </code></pre>
  
  <p>Can someone help?</p>
  
  <p>Thanks!</p>