【发布时间】:2011-12-08 05:04:43
【问题描述】:
在我的服务器上nohup sleep 1 > nohup.out & 没有提供帮助信息。很好。
在我的笔记本电脑上运行相同的命令,我得到:nohup: ignoring input and redirecting stderr to stdout。尽管命令仍然运行并正确完成,但我不明白为什么在我的两台机器之间报告此消息时存在差异。不过幸运的是,我可以通过简单地将 stderr 和 stdout 重定向到一个文件来解决笔记本电脑上的这个问题:nohup sleep 1 &> nohup.out &
所以....我想做的是在我的笔记本电脑上实现一个更有用的命令:
以下在我的服务器上运行良好,并且没有报告任何消息:nohup ls -1 *.txt | sed -e "s%\(.*\)%/home/user/scripts/script.pl -find \1 %" | sh > nohup.out &
这行代码“nohups”将文件列表通过管道传输到 sed,在其中它们连续通过 script.pl 运行并在 shell 中执行。 script.pl 将数据打印到多个文件,并将一些信息打印到标准输出。我通过将其写入名为nohup.out 的文件来捕获此信息
现在,当我在笔记本电脑上运行这个单行程序时,我得到了nohup: ignoring input and redirecting stderr to stdout。这是意料之中的(但出于我不知道的原因)。但是当我修改该行以重定向stderr和stdout时:nohup ls -1 *.txt | sed -e "s%\(.*\)%/home/user/scripts/script.pl -find \1 %" | sh &> nohup.out &
我仍然收到消息nohup: ignoring input and redirecting stderr to stdout
如何修复我的 one-liner 以使其在我的笔记本电脑上运行而不会收到显示的消息?
【问题讨论】:
-
您的服务器正在运行什么系统(操作系统和版本)?笔记本电脑呢?
-
@JonathanLeffler 我的笔记本电脑:Ubuntu 11.04。我的服务器:CentOS release 5.2