【问题标题】:nohup command & : How to discard output? [duplicate]nohup 命令 & : 如何丢弃输出? [复制]
【发布时间】:2019-11-10 18:47:51
【问题描述】:

我正在运行这个命令:

nohup google-chrome > /dev/null 2>&1 &

运行后我得到这个输出:

[1] 16975

无论如何我可以运行该命令并且根本没有输出?

提前致谢!

【问题讨论】:

  • 你得到的明显输出是外壳工作控制的一部分。要抑制 shell 的作业控制输出,您需要按照链接问题中的说明在子 shell 中运行命令。

标签: linux bash nohup dev-null


【解决方案1】:

您可以像这样使用&> 来重定向stdout 和stderr:

nohup google-chrome &> /dev/null &

要隐藏 pid,请使用 subshel​​l:

(nohup google-chrome & ) &> /dev/null 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-29
    • 2012-07-12
    相关资源
    最近更新 更多