我正在查看一个 expect 脚本,它有以下几行:
#some heading
send -- "some command\n"
expect {
-re $more {
send -- " "
exp_continue
}
">" { }
default { exit 230 }
}
# some heading
send -- "some command\n"
expect {
-re $more {
send -- " "
exp_continue
}
">" { }
default { exit 211 }
}
那么exit
命令后的数字“230”和“211”是什么意思。
最佳答案
数字是退出代码。它们的范围为 0-255,用于将程序成功或错误传达给可能调用该程序的其他应用程序(例如您的 shell)。
在 bash 和许多其他 shell 中,您可以使用 $?
检查最后一个程序的退出状态。退出状态为 0 表示成功,任何非 0 状态表示失败。您应该引用程序的文档以了解不同的退出代码可能意味着什么。
另请参阅 exit status 上的维基百科条目.
关于linux - expect脚本中 `exit`命令后的数字是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32498513/