Sending SIGINT from keyboard to piped commands in bash

后端 未结 2 1012
孤街浪徒
孤街浪徒 2021-01-04 08:31

If in bash I run a | b | c | d on the command line and then press ^C, which process gets the signal?

2条回答
  •  萌比男神i
    2021-01-04 09:21

    In short, they all do.

    When setting up a pipeline, the shell creates a process group. ^C is interpreted by the kernel's line discipline as the user's request to interrupt the process group currently running in the foreground. Sending a signal such as SIGINT to a process group automatically delivers the signal to all processes in the group.

提交回复
热议问题