cancel
Showing results for 
Search instead for 
Did you mean: 

problems in scp with expect-

Karthik_sg
Frequent Advisor

problems in scp with expect-

Guys,
I really need help as quickly as i can get on this expect scipt.it is not working as of now.Pls do try with this ur local machine and tel me whts wrong and wht needs t be done.pls post me the script if possible.its really urgent.

#!/usr/bin/expect

log_user 0

set my_passphrase "passphrase"
set my_password "xxxxx"

spawn "/usr/bin/scp" "root@x.x.x.x:/tmp/logstatus ."

while {1} {
expect {
"root@x.x.x.x's password:" {
send "$my_password?\n"
print "sending password";
}
}
break
}
interact
1 REPLY
Jean-Yves Picard
Trusted Contributor

Re: problems in scp with expect-

Hello,

I'll try with
spawn "/usr/bin/scp" root@x.x.x.x:/tmp/logstatus .
instead of
spawn "/usr/bin/scp" "root@x.x.x.x:/tmp/logstatus ."

for once, and
send "$my_password?\r"
instead of
send "$my_password?\n"

Jean-Yves
points are welcome