【问题标题】:What are the exit codes in the RPM binary?RPM 二进制文件中的退出代码是什么?
【发布时间】:2019-01-10 04:55:00
【问题描述】:

每次rpm 命令返回不同的退出代码。例如 - 如果依赖失败,有时 echo $? 会给出 1,有时会给出 5。有人可以解释一下吗?

【问题讨论】:

  • 我在man中找不到任何有关退出代码的信息
  • 对,没提。虽然我发现了这个Yes. Unfortunately, it's a very short list: the exit code equals the number of failed packages, capped at 255.redhat.com/archives/rpm-list/2005-July/msg00071.html,但不是很隐蔽
  • rpm 返回的所有错误都是一样的吗?假设有时错误是failed dependency,有时是erase failed。这两个错误的退出代码是否等于失败包的数量?

标签: linux centos redhat rpm suse


【解决方案1】:

这是因为任何原因失败的事情的数量,

$ rpm -i $(seq 1 3); echo "Failed with $?"
error: open of 1 failed: No such file or directory
error: open of 2 failed: No such file or directory
error: open of 3 failed: No such file or directory
Failed with 3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-27
    • 2017-05-28
    • 1970-01-01
    • 2020-09-25
    • 2013-09-24
    • 2017-07-26
    • 1970-01-01
    相关资源
    最近更新 更多