The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 10:45 AM
tcl/expect calsum Shell Programming and Scripting 7 03-25-2008 09:23 PM
Expect/Tcl help? earnstaf UNIX for Dummies Questions & Answers 2 07-26-2007 07:01 AM
Expect and auto expect command arun_v Shell Programming and Scripting 0 03-29-2006 04:31 AM
Expect with tcl/tk sanjustudy Shell Programming and Scripting 0 10-10-2005 02:48 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-06-2001
Registered User
 

Join Date: Nov 2001
Location: Washington
Posts: 5
Exclamation Help with expect

Help I am trying to do a script
#start
expect -F - <<EOF
spawn scp -c blowfish -C user@hostathtofile 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?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-06-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
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?
Reply With Quote
  #3 (permalink)  
Old 11-06-2001
Registered User
 

Join Date: Nov 2001
Location: Washington
Posts: 5
Yes just typo. for some reson it dosent pass the password it just hangs on expect "password:"
Reply With Quote
  #4 (permalink)  
Old 11-06-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
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?
Reply With Quote
  #5 (permalink)  
Old 11-06-2001
Registered User
 

Join Date: Nov 2001
Location: Washington
Posts: 5
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
Reply With Quote
  #6 (permalink)  
Old 11-06-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Cool.

I assume it was the use of double quotes?

Does it work with just...

expect "word:"
Reply With Quote
  #7 (permalink)  
Old 11-09-2001
Registered User
 

Join Date: Nov 2001
Location: Washington
Posts: 5
Talking The only Delema

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?
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0