title: phpseclib: "CAT" command works randomly
body: <p>I have a script that fetches data from a site.
  Basically it is divided into two section. 
  1.executes commands on a remote machine and saves output in a file
  2.read the contents of a file.
  For some reason it works from time to time. Section 1 always works (checked the remote machine and found the files). The problem is related to cat.
  I've added to my code the option to dump the results of "CAT" command to a file.
  Sometimes it has info sometimes it doesn't. However the file is always created!
  The nodes i'm querying are the same. Timeout of execution of Section 1 on a remote server is 11-12 secs.</p>
  
  <p>Thanks beforehand.</p>
  
  <pre><code>$ssh-&gt;exec("rm toolkit/mybatch/$newfileid");
                      $ssh-&gt;exec("mobatch $newsiteid 'lt all;ue print -admitted;' toolkit/mybatch");
                      $ssh-&gt;setTimeout(15);                       
                      echo $ssh-&gt;exec('cat ' . escapeshellarg("toolkit/mybatch/$newfileid") . '| grep -A 10 \'$ ue print \' &gt; toolkit/mybatch/traffic.txt');
                      $traffic = $ssh-&gt;exec("cat toolkit/mybatch/traffic.txt");
                      $traffic = substr($traffic,21,-16);
                      $ssh-&gt;disconnect();
                      echo $traffic;
  </code></pre>
  
  <p>I've updated the code above, however, it worked several times , but after deletion of old files, it only creates "traffic.txt" and sometimes it has info in it, sometimes no.
  Also, the file "traffic.txtescapeshellarg" is not created anymore. So i was forced to go back to my previous solution and read the "traffic.txt".</p>