EXPECT AND SFTP

Matthew Claridge mclaridge at rwa-net.co.uk
Fri Aug 20 16:18:25 UTC 2004


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 at embraer.com.br 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.
>
>
>  
>





More information about the redhat-list mailing list