Chinaunix首页 | 论坛 | 博客
  • 博客访问: 433058
  • 博文数量: 79
  • 博客积分: 8385
  • 博客等级: 中将
  • 技术积分: 3625
  • 用 户 组: 普通用户
  • 注册时间: 2005-09-26 14:42
文章分类

全部博文(79)

文章存档

2011年(10)

2010年(40)

2009年(21)

2008年(8)

分类: LINUX

2008-11-19 15:17:17

+
 
#!/usr/bin/expect -f
set ipaddress [lindex $argv 0]
set passwd [lindex $argv 1]
set timeout 5
spawn ssh
#######Input "yes" when prompt "yes/no"############
expect {
"yes/no" { send "yes\r"; exp_continue}
"password:" { send "$passwd\r" }
}
###################################################
expect "password:"
send "$passwd\r"
expect "]*"
send "mkdir -p /tmp/haha/haha2\r"
send "exit\r"
 
#./script IP PASSWD 就可以登录了
阅读(392) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~