Monday, August 10, 2009

 

expect @ work - to automate password entry

#!/usr/bin/expect -f

# connect via scp
spawn scp "user@example.com:/home/santhosh/file.dmp" /u01/dumps/file.dmp
#######################
expect {
-re ".*es.*o.*" {
exp_send "yes\r"
exp_continue
}
-re ".*sword.*" {
exp_send "PASSWORD\r"
}
}
interact

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?