Re: EXPECT AND SFTP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't think you need the 'interact' command in your expect script if you're piping things into it......

alternatively, pass the filename (or list of filenames or name of file containing a list of filenames) to expect on the command line, like:

./myftp username machine passwd filename

then just handle this inside your expect script:

Matt

on 19/08/2004 18:46 diego.veiga@xxxxxxxxxxxxxx said the following:


Hi guy,

I'm running sftp with expect.
my expect file:

more mysftp
#!/usr/local/bin/expect -f

set user [lindex $argv 0];
set machine [lindex $argv 1];
set pass [lindex $argv 2];
log_user 1;
exp_internal 1;
spawn sftp $user@$machine;
expect "$user@$machine's password:";
send "$pass\r" ;
expect {
 "su:\ Authentication\ failure" {
        send_user "Erro ao autenticar.\n"
   log_user 1;
              exit;
 }
}
log_user 1;
interact;
exit 0;

Example: ./myftp username machine passwd
sftp>
like this it's logging ok.

if i use
./myftp username machine passwd <<EOF
put file1
EOF

it doesn't return error but don't put the file1 into username home.
I don't wanna use the -b batchfile mode in sftp, but it seems that is the
only way.. does anyone have been tried it?

regards,

diego

This message is intended only for the use of the person(s) to whom it is
addressed. Any dissemination, distribution, copying or filing of this
message or any of its content by any person other than the Intended
recipient is prohibited. If you have received this email in error please
notify the sender or system manager as soon as possible.

Esta mensagem é para uso exclusivo de seu destinatário e pode conter
informações privilegiadas e confidenciais.Se você não é o destinatário, não
deve distribuir, copiar ou arquivar a mensagem.






--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux