On Oct 21, 8:27 pm, [EMAIL PROTECTED] (Juan Pablo Feria Gomez) wrote:
> > use strict;
> > use warnings;
> > use Expect;
> > use IO::Tty;
>
> > $host = "192.168.1.72";
> > $passwd= "xyz";
> > $user = "xyz";
>
> > $t= "file.txt";
> > my $connect = Expect->spawn("scp $t [EMAIL PROTECTED]:/work/$user/");
> > $connect->expect(30,"\s") ||die "junk1";
> > print $connect $passwd."\n";
>
> Do you want to send the password?, let expect wait for the prompt
>
> $connect->expect(30, "word:");
> $connect->send("$passwd\n");
>
> > $connect->expect(30,"-re",'$\s');
> > $connect->soft_close();

For this you need to install following packages

gcc is required for IO::Tty module

cpan> install Expect
cpan> install IO::Tty
cpan> install Net::SSH::Expect


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to