如题,expect脚本匹配的时候竟然不往下跑,我用
expect -d 进行调试执行的。下面是执行结果,我打出来停止的时候的内容
expect: does "\r\nProduct Name: Meerkat\r\nPCB Assembly: 110-00052\r\nRevision: <No Data>\r\nDate of manufacture: Unknown\r\nSerial Number: <No Data>\r\nManufacture Info: <No Data>\r\nMisc: COBRA PROD\r\n------------------------------------------------------------\r\n\r\n\r\n--------- Public EEPROM Test Conclusions of slot 3 ---------\r\nPassed.\r\n------------------------------------------------------------\r\n\r\nPress any key to continue\r\n" (spawn_id exp4) match regular expression "Board ID:(\s*)(\d+)"? no
"Model:(\s*)(\w+)"? no
"PCB Assembly:(\s*)(\d+-\d+)"? yes
expect: set expect_out(0,string) "PCB Assembly: 110-00052"
expect: set expect_out(1,string) " "
expect: set expect_out(2,string) "110-00052"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "\r\nProduct Name: Meerkat\r\nPCB Assembly: 110-00052"
expect: continuing expect
expect: does "\r\nRevision: <No Data>\r\nDate of manufacture: Unknown\r\nSerial Number: <No Data>\r\nManufacture Info: <No Data>\r\nMisc: COBRA PROD\r\n------------------------------------------------------------\r\n\r\n\r\n--------- Public EEPROM Test Conclusions of slot 3 ---------\r\nPassed.\r\n------------------------------------------------------------\r\n\r\nPress any key to continue\r\n" (s
这里,到最后没有了“spawn_id...”
只打出来了一个"s"然后就等待timeout了。是什么原因呢?
下面贴与此相关的 expect脚本部分
[code=C#][/code]proc Save_MeerkatPub {} {
match_max 20000
global Meerkat_Public
expect {
-re "Board info in slot (\\d+)" {
set timeout 100
expect {
-re "Board ID:(\\s*)(\\d+)" {set Meerkat_Public(BoardId) $expect_out(2,string); exp_continue}
-re "Model:(\\s*)(\\w+)" {set Meerkat_Public(Model) $expect_out(2,string); exp_continue}
-re "PCB Assembly:(\\s*)(\\d+-\\d+)" {set Meerkat_Public(Assembly) $expect_out(2,string); exp_continue}
-re "Revision:(\\s*)(\\w+)" {set Meerkat_Public(Revision) $expect_out(2,string); exp_continue}
#-re "Revision:(\\s*)(\\w+)" {set Meerkat_Public(Revision) $expect_out(2,string); exp_continue}
-re "Date of manufacture:(\\s*)(\\d+)" {set Meerkat_Public(Date) $expect_out(2,string); exp_continue}
-re "Serial Number:(\\s*)(\\d+)" {set Meerkat_Public(SerialNum) $expect_out(2,string); exp_continue}
-re "Manufacture Info:(\\s*)(\\w+)" {set Meerkat_Public(Manufacturer) $expect_out(2,string); exp_continue}
-re "Misc:(\\s*)((\\w+)(\\s*)(\\w+))\|Misc:(\\s*)(\\w+)" {set Meerkat_Public(Misc) $expect_out(2,string); exp_continue}
"Mac Address:" {;}
}
return
}
}
}
------解决方案--------------------------------------------------------
不懂,帮你顶一下!
------解决方案--------------------------------------------------------
不懂,也帮你顶一下,蹭点分..
------解决方案--------------------------------------------------------
当然有问题了,expect_out(2,
2个字符。