title: Get Return Code of SFTP command
body: <p>I have the snippet below inside my ksh script. Is there a way that I can have a return code whether the sftp executed successfully and copied the files from source to target destination?</p>
  
  <pre><code>echo "sftp start" &gt;&gt; /test/logfile.log
  sftp user@server &lt;&lt;EOF &gt;&gt; /test/logfile.log
  cd /tgt/files
  lcd /src/files
  rm *.csv
  put -p *.csv
  exit
  EOF
  echo "sftp end" &gt;&gt; /test/logfile.log
  </code></pre>