一个简单的expect脚本
上一篇 / 下一篇 2011-08-27 23:53:00 / 个人分类:Shell学习
TAG:
- 引用 删除 abinNO1 / 2013-03-20 21:28:08
-
自动scp一个文件到远程服务器,此处的exp_continue意思是继续执行下面的匹配,可以换成expect eof表示匹配结束符。
#!/usr/bin/expect
if {$argc!=4} {
send_user "Usage: $argv0 {file_name} {ipaddress} {path} {password}\n"
exit
}
set file [lindex $argv 0]
set ip [lindex $argv 1]
set path [lindex $argv 2]
set password [lindex $argv 3]
spawn /usr/bin/scp -r $file root@$ippath
expect {
"(yes/no)?"
{
send "yes\r"
expect "*assword:*"
send "$password\r"
exp_continue
}
"*assword:*"
{
send "$password\r"
exp_continue
}
}
- 引用 删除 abinNO1 / 2011-09-14 16:12:18
-
http://www.cnblogs.com/kevin-wu/archive/2006/11/27/574369.html
close_wait状态生成的起因。
- 引用 删除 abinNO1 / 2011-09-07 19:46:33
-
http://topic.csdn.net/u/20071121/16/47FB018D-3AD6-4A5B-8E74-2838BBD70DB9.html
vi高亮显示
我的栏目
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | 5 | 6 | ||||
7 | 8 | 9 | 10 | 11 | 12 | 13 | |||
14 | 15 | 16 | 17 | 18 | 19 | 20 | |||
21 | 22 | 23 | 24 | 25 | 26 | 27 | |||
28 | 29 | 30 |
我的存档
数据统计
- 访问量: 124386
- 日志数: 67
- 建立时间: 2010-12-07
- 更新时间: 2019-08-28