elnet 10.13.32.30 7001
5. 函数定义和调用
proc do_console_login {login pass} {
..............
}
6. 变量赋值
set done 1 7. 循环
while ($done) {
................
}
8. 条件分支Switch
switch -- $timeout_case { 0 { ............... } 1 { ............... } 2 { ............... } }
9. 运算 incr timeout_case
此外,还可以看到 Expect的以下命令: send expect send_user
可以通过-d参数调试Expect脚本:
# /usr/bin/expect -d sample_login.exp root 111111
......调试输出和程序输出.......
参考文档: Unix/Linux 平台任务的自动化 Expect 教程中文版
上一页 [1] [2] [3] |