bash signal trap will override the signal of its nohup sub commands? bash signal trap will override the signal of its nohup sub commands? shell shell

bash signal trap will override the signal of its nohup sub commands?


The bash manual says:

When a simple command other than a builtin or shell function is to be executed, it is invoked in a separate execution environment that consists of the following. Unless otherwise noted, the values are inherited from the shell.

  • the shell’s open files, plus any modifications and additions specified by redirections to the command
  • the current working directory
  • the file creation mode mask
  • shell variables and functions marked for export, along with variables exported for the command, passed in the environment (see Environment)
  • traps caught by the shell are reset to the values inherited from the shell’s parent, and traps ignored by the shell are ignored

man sigaction says:

A child created via fork(2) inherits a copy of its parent's signal dispositions. During an execve(2), the dispositions of handled signals are reset to the default; the dispositions of ignored signals are left unchanged.

So yes, the SIGINT get's ignored because the parent shell ignores it.