-1
我开始学习新的预期脚本。你能否理解下面的代码中发生了什么?预期脚本中的多重产卵
有一个叫one.exp的代码文件如下
#!/usr/bin/expect
global slawn_id
set timeout -1
spawn NoPktdrop.exp
spawn perl NoPktDrop.pl NoPktDrop
spawn NoPktDrop.exp
spawn perl NoPktDrop.pl NoPktDrop
interact
the code of NoPktdrop.exp is as follows.
#!/usr/bin/expect
set timeout -1
while {1} {
spawn telnet server
sleep 1
expect {
"Escape character" {
send "\r"
expect "SP*>*%"
break
}
"Connection refused" {
break
}
}
}
send "\x1D"
expect "telnet> "
send "q\r"
expect "Connection*%"
和Perl脚本有一些代码。
我需要先执行expect脚本,然后一旦生成了NoPktDroplog,日志需要被赋予perl脚本进行一些检查。我需要重复一些原因。但是我看到预期的脚本没有被执行。只有perl脚本被执行。请让我知道原因。
你想'eof'不是'eop' - 预计EOF将让你等待(最大超时值)产生的进程完成。 –
感谢格伦提供的理由。你能否提到为什么我需要删除交互。我无法得到需要完全交互的地方。 – sri