I have lost track from who this was originally sent, but this is what I
think is wrong with
your script (the original script).

1. open requires 2 arguments, you had 1.  So you may want to re-write your
open stmt as:

open FTPSCR, "|ftp -n -v $hostname > ftplog\n";   #insert a comma

As a precaution, I always use

open (FTPSCR, "|ftp -n -v $hostname > ftplog\n")  || die "\n I have a
head-ache\n\n";

----------------------------------------------

2.  I have not used this: print FTPSCR "lcd $destdir\n";
before, but I am assuming it works.

---------------------------------------------

3.  It should work now.

-------------------------------------


Alternatively, I always use
macdef init

with a .netrc file.  This prevents the USER-ID and PASSWORD from appearing
in "ps -ef".

This is my approach:

1. Users have secured .netrc file   (permission set to -rw-------)
2.  My perl program wil then look like:


#!/opt/local/bin/perl

$hostname = 'mvscs1';
$username = $ENV{USER};
$ftp_inst_file = "foo.txt";

#.....................................
open ( INSTR, "> $ftp_inst_file") || die "\n Could not open
$ftp_inst_file\n\n";

print INSTR <<EOF
bin
get UNNAMED.FIG
ls
by
EOF
;

close (INSTR);

open (FTPSCR, "|ftp -v $hostname < $ftp_inst_file > ftplog\n");  #I
redirect the request.
close FTPSCR;                                                    #this
allows me to test the request file if I want

 #   You can then destroy the request file if you are satisfied that the
program works well.

__________________

William Ampeh (x3939)
Federal Reserve Board


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to