如何在没有匹配时使用expect发送命令

  • 本文关键字:expect 命令 expect
  • 更新时间 :
  • 英文 :


当期望值不匹配时,是否可以发送默认命令?

我想让参赛者参赛,直到比赛结束?

set timeout 60
expect {
timeout {
puts "Failed to find foo"
exit 1
}
"foo" {
exit
}
default {
send "r"
}
}

您可以期望行尾发送回车:expect将行尾转换为rn

expect {
timeout {
puts "Failed to find foo"
exit 1
}
"foo" {
exit
}
"rn" {
send "r"
exp_continue
}
}

最新更新