<?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 Re: ftp script question .. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573646#M857697</link>
    <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you need a "EOF" after the put *.vox and b4 the done line. &lt;BR /&gt;&lt;BR /&gt;-Ramesh</description>
    <pubDate>Fri, 31 Aug 2001 16:12:19 GMT</pubDate>
    <dc:creator>linuxfan</dc:creator>
    <dc:date>2001-08-31T16:12:19Z</dc:date>
    <item>
      <title>ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573643#M857694</link>
      <description>I have read the past post on ftp scripts. I got one that works for what I need but I am trying to modify it a little. Here it is.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;HOSTNAME_FILE=ivrs.txt&lt;BR /&gt;for host in $(cat $HOSTNAME_FILE)&lt;BR /&gt;do&lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF&lt;BR /&gt;open $host&lt;BR /&gt;user username password&lt;BR /&gt;lcd /home/richardl/english&lt;BR /&gt;cd netip&lt;BR /&gt;put *.vox&lt;BR /&gt;done&lt;BR /&gt;#&lt;BR /&gt;#.end&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When I run it I get&lt;BR /&gt;./testftp[3]: Syntax error at line 5 : `&amp;lt;&amp;lt;' is not matched.&lt;BR /&gt;&lt;BR /&gt;why am i getting that error?&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Fri, 31 Aug 2001 16:05:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573643#M857694</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-08-31T16:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573644#M857695</link>
      <description>Hi Richard:&lt;BR /&gt;&lt;BR /&gt;The ftp -n &amp;lt;&amp;lt; EOF is the 'here docs' convention.&lt;BR /&gt;It means take input from the script until it sees the string 'EOF' at the beginning of a line. You appear to be missing the 'EOF' which should follow your last ftp command (quit).&lt;BR /&gt;&lt;BR /&gt;By the way, you can use any string 'XXX', '!!!', '!EOF!', ... just so long as the &amp;lt;&amp;lt; XXX is matched with XXX.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Fri, 31 Aug 2001 16:11:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573644#M857695</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-08-31T16:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573645#M857696</link>
      <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;Before the done put&lt;BR /&gt;&lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;you need to "quit" from ftp and tell the shell that your redirected input (&amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Fri, 31 Aug 2001 16:12:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573645#M857696</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-08-31T16:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573646#M857697</link>
      <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you need a "EOF" after the put *.vox and b4 the done line. &lt;BR /&gt;&lt;BR /&gt;-Ramesh</description>
      <pubDate>Fri, 31 Aug 2001 16:12:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573646#M857697</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-31T16:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573647#M857698</link>
      <description>OOps,&lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;put *.vox&lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Also if you are using multiple files you have to use prompt and mput rather than put so your script would look like&lt;BR /&gt;&lt;BR /&gt;/Begin/&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;HOSTNAME_FILE=ivrs.txt &lt;BR /&gt;for host in $(cat $HOSTNAME_FILE) &lt;BR /&gt;do &lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF &lt;BR /&gt;open $host &lt;BR /&gt;user username password &lt;BR /&gt;prompt&lt;BR /&gt;lcd /home/richardl/english &lt;BR /&gt;cd netip &lt;BR /&gt;mput *.vox &lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh</description>
      <pubDate>Fri, 31 Aug 2001 16:16:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573647#M857698</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-31T16:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573648#M857699</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;You forgot EOF just before&lt;BR /&gt;done.&lt;BR /&gt;&lt;BR /&gt;Also you need to say quit before EOF&lt;BR /&gt;&lt;BR /&gt;..........&lt;BR /&gt;put *.vox&lt;BR /&gt;quit&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2001 16:17:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573648#M857699</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-08-31T16:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573649#M857700</link>
      <description>im trying to add a test statement. &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;PATH=/usr/sbin/ping:/usr/bin/:${PATH}&lt;BR /&gt;export PATH&lt;BR /&gt;cd /home/richardl&lt;BR /&gt;HOSTNAME_FILE=ivrs&lt;BR /&gt;for host in $(cat $HOSTNAME_FILE)&lt;BR /&gt;do&lt;BR /&gt;/usr/sbin/ping $host -n 1 | grep -q '1 packets received'&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "$host down"&lt;BR /&gt;else&lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF&lt;BR /&gt;open $host&lt;BR /&gt;&lt;BR /&gt;so it pings the host if i fails to go into a file. And if ping does not fail to proceed with the ftp. But for some reason it is bypassing the ftp statement and even if the ping is good that it tells me the host is down.&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2001 18:05:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573649#M857700</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-08-31T18:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573650#M857701</link>
      <description>I think you have your statement backwards in the your if.&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;EOF&lt;BR /&gt;else&lt;BR /&gt;echo "$host down"&lt;BR /&gt;fi</description>
      <pubDate>Fri, 31 Aug 2001 18:14:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573650#M857701</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-08-31T18:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573651#M857702</link>
      <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;Your logic seems ok, its just that in your if statement change it to !=&lt;BR /&gt;because when it pings the machine the output is 0 and when it fails it 1&lt;BR /&gt;&lt;BR /&gt;so change it to&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;PATH=/usr/sbin/ping:/usr/bin/:${PATH} &lt;BR /&gt;export PATH &lt;BR /&gt;cd /home/richardl &lt;BR /&gt;HOSTNAME_FILE=ivrs &lt;BR /&gt;for host in $(cat $HOSTNAME_FILE) &lt;BR /&gt;do &lt;BR /&gt;/usr/sbin/ping $host -n 1 | grep -q '1 packets received' &lt;BR /&gt;if [ $? != 0 ] &lt;BR /&gt;then &lt;BR /&gt;echo "$host down" &lt;BR /&gt;else &lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF &lt;BR /&gt;open $host &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Ramesh&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2001 18:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573651#M857702</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-31T18:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573652#M857703</link>
      <description>Hi Richard:&lt;BR /&gt;&lt;BR /&gt;Change:&lt;BR /&gt;&lt;BR /&gt;# if [ $? = 0 ] &lt;BR /&gt;&lt;BR /&gt;...to...&lt;BR /&gt;&lt;BR /&gt;# if [ $? -eq 0 ]&lt;BR /&gt;&lt;BR /&gt;...and your test will work.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 31 Aug 2001 18:18:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573652#M857703</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-31T18:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573653#M857704</link>
      <description>Hi (again) Richard:&lt;BR /&gt;&lt;BR /&gt;Ooops!  No points for me!  Patrick &amp;amp; Ramesh are correct.  You have the test backwards.&lt;BR /&gt;&lt;BR /&gt;Either [ $? -ne 0 ] or [ $? != 0 ] in lieu of [ $? = 0 ] will fix your problem.&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2001 18:37:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script-question/m-p/2573653#M857704</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-31T18:37:16Z</dc:date>
    </item>
  </channel>
</rss>

