【问题标题】:In which condition "nice" command's return value will be 33?在什么情况下“nice”命令的返回值为 33?
【发布时间】:2017-03-27 06:16:03
【问题描述】:

“nice”命令返回值为 33。请帮助我理解为什么 nice 将值返回为 33。在某些系统中,将返回值为 0 时它工作得很好,但在系统上它给我的返回值为 33。

    nice -n -10 <doing some process here> 
    returnValue=$?

这里 returnValue 得到一个值 33,尽管是 0。

【问题讨论】:

  • 您使用的是哪个外壳?也许nice 是你的shell 的内置命令。或者试试/usr/bin/nice;或者 niced 命令返回 33
  • 我正在使用“bash”外壳。我会尝试使用 /usr/bin/nice

标签: linux return-value nice


【解决方案1】:

看起来nice(1) 正在返回 niced 命令的exit 代码*。试试

nice bash -c 'exit 13' ; echo $?

你得到 13。所以你的 niced 命令得到了一个 exit 代码 33。我们不能告诉你 那个是怎么发生的,因为你不知道你在 nicing 什么命令.顺便说一句,一些 shell 可能有一个很好的内置函数,所以你可以明确地使用 /usr/bin/nice 而不是 nice


注意*:即使nice 失败(例如nice -n -12 id 不是root),它也会对stderr 说些什么,但退出0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2014-09-12
    • 2018-04-26
    • 2018-05-21
    • 2021-08-14
    • 1970-01-01
    • 2017-05-07
    相关资源
    最近更新 更多