linux - CLI : Exit code on confirmation question? 1 或 0

标签 linux shell command-line-interface exit-code

简单的问题。在 cli 脚本中

您想继续吗?

如果用户说“不”。退出代码必须为 0?或者不是,为什么?

最佳答案

从程序的角度来看,它肯定是 0。但是我编写了一些脚本,其中捕获了退出代码来解释程序的退出状态。在这种情况下,我捕获了系统退出代码,并为所选的每个选项分配了新的退出代码,以通知程序执行的最终状态。希望这有帮助!

关于linux - CLI : Exit code on confirmation question? 1 或 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53304662/

相关文章:

linux - ip route add 通过在同一网络中指定源地址

linux - 使用带有附件和主题行的 unix 命令发送邮件

linux - 我需要从多个文件中删除一行

shell - 如何从 POSIX shell 脚本中删除 root 权限?

Bash:选择与模式匹配的上一个命令

regex - 将正则表达式与 grep 结合使用来过滤详细命令输出中的数据

javascript - 无法在 linux 中运行 npx react-native init

Linux shell 脚本 : make a folder with the current date name

linux - 如何更改 zenity 输入分隔符

php - 在 MacOS 中将 ZeroMQ 绑定(bind)到 PHP