<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic sftp in a batch in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088750#M93157</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I was using ftp with the here-document,however i have to replace ftp with sftp.I am using a batch file for sftp but the problem is i am not able to interpret the shell variables in the batch file.Any ideas how to go about?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan</description>
    <pubDate>Sat, 19 Jan 2008 18:04:00 GMT</pubDate>
    <dc:creator>Gyankr</dc:creator>
    <dc:date>2008-01-19T18:04:00Z</dc:date>
    <item>
      <title>sftp in a batch</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088750#M93157</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I was using ftp with the here-document,however i have to replace ftp with sftp.I am using a batch file for sftp but the problem is i am not able to interpret the shell variables in the batch file.Any ideas how to go about?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan</description>
      <pubDate>Sat, 19 Jan 2008 18:04:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088750#M93157</guid>
      <dc:creator>Gyankr</dc:creator>
      <dc:date>2008-01-19T18:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: sftp in a batch</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088751#M93158</link>
      <description>Hi Gyan:&lt;BR /&gt;&lt;BR /&gt;Why not create a here-document on-the-fly and remove it afterwards.  Something like:&lt;BR /&gt;&lt;BR /&gt;# cat ./mysftp&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset SRCFILE=/tmp/xxx&lt;BR /&gt;typeset DSTFILE=/tmp/yyy&lt;BR /&gt;typeset MYBATCH=/var/tmp/mybatch.$$&lt;BR /&gt;typeset MYUSER=theuser&lt;BR /&gt;typeset MYHOST=thehost&lt;BR /&gt;&lt;BR /&gt;trap 'rm ${MYBATCH}' EXIT&lt;BR /&gt;&lt;BR /&gt;(&lt;BR /&gt;cat &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;put  -P ${SRCFILE} ${DSTFILE}&lt;BR /&gt;EOF&lt;BR /&gt;) &amp;gt; ${MYBATCH}&lt;BR /&gt;&lt;BR /&gt;sftp -b ${MYBATCH} ${MYUSER}\@${MYHOST}&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;...when the script exits, the 'trap' runs and removes the ${MYBATCH} file created.  Variable substitution occurs when the here-document is built.  Note that the running pid of the process is used to name the temporary here-document (${MYBATCH}) thereby avoiding name collisions.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 19 Jan 2008 19:26:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088751#M93158</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-01-19T19:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: sftp in a batch</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088752#M93159</link>
      <description>Thanks for your suggestion James,i will try it out.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan</description>
      <pubDate>Mon, 21 Jan 2008 21:18:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-in-a-batch/m-p/5088752#M93159</guid>
      <dc:creator>Gyankr</dc:creator>
      <dc:date>2008-01-21T21:18:06Z</dc:date>
    </item>
  </channel>
</rss>

