当期望值不匹配时,是否可以发送默认命令?
我想让参赛者参赛,直到比赛结束?
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
}
}