Append
&after the command detaches it fromstdinwhich means the shell isn’t tied up by the command and you can execute other commands.However, the command process is still managed by the shell and
stdoutandstderrare still attached to the shell session.This means that when the shell session ends (you close your terminal window, exit ssh, etc) the command’s process is sent a HUP signal, which usually terminates the command.
The shell associates a
jobwith each pipeline. It keeps a table of currently executing jobs, which may be listed with the jobs command.All of the processes in a single pipeline are members of the same job. Bash uses the job abstraction as the basis for job control.
To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a current terminal process group id.
本文深入探讨了在bash shell中如何正确地将命令后台运行,理解其与标准输入、输出和错误流的关系,以及shell如何管理这些进程。通过详细解释管道作业的概念和bash对job控制的实现,读者将掌握如何有效地组织和控制shell脚本中的多个命令执行流程。
1287

被折叠的 条评论
为什么被折叠?



