Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1236340
  • 博文数量: 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)

分类: LINUX

2013-12-20 11:12:53

proc ftp_getfile {host user key} {
  set alist [glob -nocomplain /tmp/access_gw*]
  foreach f $alist {
    file delete -force $f
  }

  set timeout 10
  spawn ftp $host

  expect "Name*"
  send "$user\r"
  expect "Password:*"
  send "$key\r"
  expect "successful*"
  expect "ftp>*"
  send "lcd /tmp\r"
  expect "ftp>*"
  send "cd update\r"
  expect "ftp>*"
  send "mget access_gw_*\r"
  expect {
  "ftp*"            { send_user "\n there is not exec file on server! \n";
            send "bye\r";
            expect eof;
            return -1;}

  -ex "?"        { send "y\r"; }
  }
  expect "OK";
  expect "ftp>*"
  send "bye\r";
  expect eof;
 
  return 0
}
阅读(1423) | 评论(0) | 转发(0) |
0

上一篇:mingw编译czmq 2.0.3

下一篇:expect中文手册

给主人留下些什么吧!~~