Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1237400
  • 博文数量: 389
  • 博客积分: 2874
  • 博客等级: 少校
  • 技术积分: 3577
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:34
文章分类

全部博文(389)

文章存档

2020年(2)

2018年(39)

2017年(27)

2016年(3)

2015年(55)

2014年(92)

2013年(54)

2012年(53)

2011年(64)

分类: Python/Ruby

2012-02-19 12:47:51

  1 #!/usr/bin/expect
  2 set timeout 1
  3 if { $argc != 1 } {
  4     send_user "Usage:cmd  telnetip \n"
  5     exit
  6 }
  7
  8 send_user "remote telnet ip is $argv \n"
  9
 10 spawn telnet $argv
 11 expect {
 12     "login:" { send "root\r"}
 13     timeout  { send_user "$argv is not alive\n"
 14                 exit 1
 15               }
 16 }
 17 expect {
 18     "*word*" {send "\r"}
 19     "*#" {send "\r"}
 20 }
 21 #send "cd /bin;ftpget -u usrname -p password  ip sfile dfile\r""
 23 expect "#"
 24 send "date ; ls -l dfile\r"
 25 expect "#"
 26 send "exit\r"
 27 expect eof

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