Chinaunix首页 | 论坛 | 博客
  • 博客访问: 248996
  • 博文数量: 61
  • 博客积分: 1370
  • 博客等级: 中尉
  • 技术积分: 452
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-04 23:40
文章分类

全部博文(61)

文章存档

2012年(1)

2011年(60)

我的朋友

分类: LINUX

2011-09-17 19:48:04

#!/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

阅读(1412) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~