title: Shell script with SFTP and mget finishing before downloads are complete
body: <p>Here is my script:</p>
  
  <pre><code>#!/usr/bin/expect
  spawn /usr/bin/sftp user@place
  expect "password:"
  send "mysecret\n"
  expect "sftp&gt;"
  send "mget dir/*.csv\n";
  expect "sftp&gt;"
  send "quit\n"
  </code></pre>
  
  <p>It starts to download but after a few seconds, it sends the quit command and exits the program before the downloads are complete.</p>
  
  <p>The only way I've successfully made it stop is to throw in an "interact" command but because I want to run this as a cron job, I don't want to just spawn processes that end up sitting.</p>
  
  <p>Is there a way to accomplish this?</p>
  
  <p>edit:</p>
  
  <p>Someone will ask why I don't have a key setup... this is the only method allowed to me by the vendor.</p>