更新时间:2023-02-07 14:32:12
在循环结束时您已经在等待eof
,您只需要使用wait
和catch
结果:
You're already waiting for the eof
at the end of your loop, you just need to use wait
and catch
the result:
spawn true
expect eof
catch wait result
exit [lindex $result 3]
退出为0.
spawn false
expect eof
catch wait result
exit [lindex $result 3]
以1退出.