Help with expect

Help I am trying to do a script
#start
expect -F - <<EOF
spawn scp -c blowfish -C user@host:pathtofile destination
expect 'word':
send 'password\r'
while {1}{expect eof{break}}
wait
eof
#end
whats wrong with this its not working? and whats a good way to have it copy multiple files?

I believe scp will prompt for "passphrase" not "password".
Also, you have...

expect 'word':

...the ":" is outside of the quotes. Was that just a typo?

Yes just typo. for some reson it dosent pass the password it just hangs on expect "password:"

Does your "scp" server prompt for "password:" ?

For instance, mine will prompt as follows...
Enter passphrase for RSA key '/home/bbarrett/.ssh/identity':

...since I'm set up for RSA or DSA auth only. No passwords.
Can you verify how your server is set up?

I tried this and it works a little crude but

#start File
expect -f - <<EOF
spawn scp user@host:smtprelay01.latest.sum smtprelay01.txt
expect "user@host password:"
send "password\r"
spawn scp user@host:smtprelay02.latest.sum smtprelay02.txt
expect "user@host password:"
send "password\r"
spawn scp user@host:smtprelay03.latest.sum smtprelay03.txt
expect "user@host password:"
send "password\r"
#while {1} {expect EOF{break}}
wait
EOF
#end

Cool. :cool:

I assume it was the use of double quotes?

Does it work with just...

expect "word:"

The only Problem is the way I wrote the script it logsin...logsout...logsin...logsout...over and over is there any way to string the scp commands together after the expect login?

It looks like you're renaming each file on the
target host. If you don't need to rename the files
then you should be able to...

scp user@host:smtprelay0?.latest.sum .

You can always use a shell script locally to
rename them after you have received them all.

Yes I need to rename them, because the database sees them and imports them on the fly. This whole thing is all in a cron job. So I guess doing multiple scp on the same login is not possible. I appricate your help Thank you.