<?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 variable in ftp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717829#M588355</link>
    <description>Group,&lt;BR /&gt;&lt;BR /&gt;Here's the scenario&lt;BR /&gt;&lt;BR /&gt;SP=U020505&lt;BR /&gt;&lt;BR /&gt;ftp -v -i HOST1&lt;BR /&gt;hash on&lt;BR /&gt;glob on&lt;BR /&gt;bin&lt;BR /&gt;mget ${SP}&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;doesn't work.&lt;BR /&gt;&lt;BR /&gt;mget U020505&lt;BR /&gt;&lt;BR /&gt;does work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;tx,&lt;BR /&gt;c&lt;BR /&gt;</description>
    <pubDate>Mon, 06 May 2002 15:02:52 GMT</pubDate>
    <dc:creator>Charles McCary</dc:creator>
    <dc:date>2002-05-06T15:02:52Z</dc:date>
    <item>
      <title>variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717829#M588355</link>
      <description>Group,&lt;BR /&gt;&lt;BR /&gt;Here's the scenario&lt;BR /&gt;&lt;BR /&gt;SP=U020505&lt;BR /&gt;&lt;BR /&gt;ftp -v -i HOST1&lt;BR /&gt;hash on&lt;BR /&gt;glob on&lt;BR /&gt;bin&lt;BR /&gt;mget ${SP}&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;doesn't work.&lt;BR /&gt;&lt;BR /&gt;mget U020505&lt;BR /&gt;&lt;BR /&gt;does work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;tx,&lt;BR /&gt;c&lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2002 15:02:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717829#M588355</guid>
      <dc:creator>Charles McCary</dc:creator>
      <dc:date>2002-05-06T15:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717830#M588356</link>
      <description>Hi: &lt;BR /&gt;&lt;BR /&gt;In the past, I used to do this stuff in the shell but now I NEVER do because I have found a much cleaner way to do it that makes error trapping and variable substitution duck soup. Do this stuff in Perl using the Net::FTP module which is available from &lt;A href="http://www.cpan.org" target="_blank"&gt;http://www.cpan.org&lt;/A&gt; . &lt;BR /&gt;&lt;BR /&gt;Here's how simple it can be: &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w &lt;BR /&gt;&lt;BR /&gt;use Net::FTP; &lt;BR /&gt;use strict; &lt;BR /&gt;&lt;BR /&gt;my $ftp = Net::FTP-&amp;gt;new("remotehost",Debug =&amp;gt; 0); &lt;BR /&gt;$ftp-&amp;gt;login("cstephen","top_secret"); &lt;BR /&gt;$ftp-&amp;gt;cwd("/tmp"); &lt;BR /&gt;$ftp-&amp;gt;get("myfile"); &lt;BR /&gt;my $stat = $ftp-&amp;gt;status; &lt;BR /&gt;my $full_stat = $ftp-&amp;gt;code; &lt;BR /&gt;# $stat contains the first digit; usually all &lt;BR /&gt;# that you need to do is test if it is equal &lt;BR /&gt;# to 2. $full_stat contains the full 3-digit &lt;BR /&gt;# value but is seldom needed &lt;BR /&gt;printf("Status: %d Full Status: %d\n",$stat,$full_stat); &lt;BR /&gt;# Sample Test &lt;BR /&gt;if ($stat == 2) &lt;BR /&gt;{ &lt;BR /&gt;print "Get was good\n"; &lt;BR /&gt;} &lt;BR /&gt;else &lt;BR /&gt;{ &lt;BR /&gt;print "Get was bad\n"; &lt;BR /&gt;} &lt;BR /&gt;$ftp-&amp;gt;quit; &lt;BR /&gt;&lt;BR /&gt;I think if you start using this module you will never go back to shell scripting FTP. Moreover, these same scripts will run in the NT world. You can download a free version of perl for windows at &lt;A href="http://www.activeperl.com." target="_blank"&gt;http://www.activeperl.com.&lt;/A&gt; &lt;BR /&gt;Note that the answer is now the same on UNIX and NT and on the same subnet or across the net. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Notice that this method easily handles the error checking. If you like, you can use the shell for most of your script and simply use a bit a perl for the actual FTP transfers. In that case add the statement exit($stat) to the perl script and then your shell script does have a valid status indication. &lt;BR /&gt;&lt;BR /&gt;Regards, Clay &lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2002 15:06:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717830#M588356</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-05-06T15:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717831#M588357</link>
      <description>try this script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;SP=U020505 &lt;BR /&gt;ftp -v -i HOST1&amp;lt;&lt;EOF&gt;&lt;/EOF&gt;hash on &lt;BR /&gt;glob on &lt;BR /&gt;bin &lt;BR /&gt;mget ${SP} &lt;BR /&gt;bye &lt;BR /&gt;EOF&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;You will need to add the user/password info and perhaps a "cd" to get to the appropriate directory.  However, if you were trying to do this via a .netrc file it won't work. You can only use explicit file names (and the usual wildcards) in the file, but no variable translations will get performed.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;mark&lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2002 15:08:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717831#M588357</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2002-05-06T15:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717832#M588358</link>
      <description>Charles,&lt;BR /&gt;&lt;BR /&gt;without a doubt use Clay's example using perl - it rules!&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 06 May 2002 15:29:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717832#M588358</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-05-06T15:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717833#M588359</link>
      <description>You can also create a simple function:&lt;BR /&gt;&lt;BR /&gt;HOST=HOST1&lt;BR /&gt;SP=U020505 &lt;BR /&gt;PATH_VAR=/tmp   # Choose the dir where is $SP&lt;BR /&gt;&lt;BR /&gt;function FTPCSV   &lt;BR /&gt; { &lt;BR /&gt; `ftp -n -i $HOST&amp;lt;&lt;END&gt;&lt;/END&gt;  quote USER username&lt;BR /&gt;  quote PASS password&lt;BR /&gt;  bin&lt;BR /&gt;  cd $PATH_VAR&lt;BR /&gt;  mget ${SP}   # or just: mget $SP &lt;BR /&gt;  quit&lt;BR /&gt;  END`&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;FTPCSV   # Call FTP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Bassoi&lt;BR /&gt;If you never try, never will work</description>
      <pubDate>Tue, 07 May 2002 16:03:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717833#M588359</guid>
      <dc:creator>Ricardo Bassoi</dc:creator>
      <dc:date>2002-05-07T16:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: variable in ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717834#M588360</link>
      <description>Guys,&lt;BR /&gt;&lt;BR /&gt;thanks - I got it working...&lt;BR /&gt;&lt;BR /&gt;C</description>
      <pubDate>Tue, 07 May 2002 16:37:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-in-ftp/m-p/2717834#M588360</guid>
      <dc:creator>Charles McCary</dc:creator>
      <dc:date>2002-05-07T16:37:46Z</dc:date>
    </item>
  </channel>
</rss>

