- 论坛徽章:
- 12
|
xpect_out(x,string)
expect_out(x,start|end)
如果expect匹配是采用高级正则表达式的话(-re参数表示高级正则表达式方式匹配),那么每个子模式都有一个序号,序号从1-9,如:
set output "abbbcabkkkka"
expect -indices -re "b(b*).*(k+)" $output
那么:
set expect_out(0,start) ==> 1
set expect_out(0,end) ==> 10
set expect_out(0,string) ==> bbbcabkkkk
set expect_out(1,start) ==> 2
set expect_out(1,end) ==> 3
set expect_out(1,string) ==> bb
set expect_out(2,start) ==> 10
set expect_out(2,end) ==> 10
set expect_out(2,string) ==> k
set expect_out(buffer) ==> abbbcabkkkk
刚刚接触expect,expect_out()这个基本就是没理解是神马。
所谓的子模式指的是什么?
哪位大牛能逐句给讲解一下上面这一坨?
感激不尽。 |
|