- 论坛徽章:
- 84
|
expect 是 tcl 的一个模块;
tcl 里面所有东西都是命令, if 命令用法- # Standard simple if
- if {some condition} {
- # Note that the open-brace for the body is on the same line
- # as the if-command and condition.
-
- some conditionally executed script...
- }
- # Standard simple if with else clause
- if {some condition} {
- some conditionally executed script.
- } else {
- some script to execute if the condition is not satisfied.
- }
- # Standard multi-test if
- if {first condition} {
- thing to do if the first condition succeeds
- } elseif {second condition} {
- thing to do if the first fails, but the second condition succeeds
- } else {
- what to do if none of the conditions match - this one is optional,
- but typically good practice to anticipate unexpected responses
- }
- # Handling complex (i.e. long) conditions
- if {
- this condition stretches over
- multiple lines
- } then {
- thing to do if the condition succeeds
- }
复制代码 |
|