Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2982673
  • 博文数量: 272
  • 博客积分: 5544
  • 博客等级: 大校
  • 技术积分: 5496
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 00:48
个人简介

  每个人都要有一个骨灰级的爱好,不为金钱,而纯粹是为了在这个领域享受追寻真理的快乐。

文章分类

全部博文(272)

文章存档

2015年(2)

2014年(5)

2013年(25)

2012年(58)

2011年(182)

分类: LINUX

2011-08-07 20:30:55

  1. #!/usr/bin/expect --

  2. set timeout 30
  3. #set name [lindex $argv 0]
  4. #set pw [lindex $argv 1]
  5. set name "mars"
  6. set pw "password"
  7. log_user 0
  8. #log_file exp.log
  9. spawn ssh $name@192.168.2.247
  10. expect {
  11.     "(yes/no)" {send "yes\r"}
  12.     "password" {send "$pw\r"}
  13. }
  14. expect "mars"
  15.     send "ls -l file | awk '{print \$5}'\r"
  16. expect -re {.*\r\n(.*)\r\n.*}
  17.     puts $expect_out(1,string)
  18.     send "exit\r"
  19. expect eof
阅读(2436) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

网络安全服务2011-08-08 09:30:09