[英]How can I stop the running command in linux without knowing the pid?
[英]How I can receive output of linux command run in foreground "command &" " [number of process in foreground] [PID]" in a file?
我想重定向这个命令 firefox & 的输出,我知道添加 "&" 意味着我们将在前台运行该命令,当我们使用它时,我们会收到"[number of process in forground] [PID]" ,这就是我有:
firefox & > firefoxFile
但是当我打开 firefoxFile 时,我发现它是空的,我没有找到"[number of process in forground] [PID]" 。
&
是一个命令分隔符,就像;
是(但具有将命令放在后台之前的副作用,以及在它之后没有另一个命令不是错误的区别)。 它后面的所有内容都是一个单独的命令。
因此,重定向必须在&
之前。
因此,对于您的示例:
firefox > firefoxFile &
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.