#!/usr/bin/expect -f
set timeout 3
set server [lindex $argv 0]
spawn /usr/bin/ssh ${server}
expect {
"*are you sure you want to continue*"
{
send "yes\n"
expect {
"*assword*"
{
send "200916\n"
}
}
}
"*assword*"
{
send "200916\n"
}
}
send "PS1\=\"\# \"\n "
expect "^#*"
send "scp x 192.168.162.14:/root \n"
expect {
"*re you sure you want to continue connecting*"
{
send "yes\n"
expect {
"*assword*"
{
send "200916\n"
}
}
}
"*assword*"
{
send "200916\n"
}
"^#*"
{
send "\n"
}
}
expect "^#*"
#interact
send "exit\n"
expect eof
阅读(1443) | 评论(0) | 转发(0) |