我有以下shell交互:
[OP@localhost linux]$ tty
/dev/pts/7
[OP@localhost linux]$ stty tostop
[OP@localhost linux]$在另一个终端中,我键入:
[OP@localhost linux]$ echo hello > /dev/pts/7回到原版,我看到了:
[OP@localhost linux]$ tty
/dev/pts/7
[OP@localhost linux]$ stty tostop
[OP@localhost linux]$ hello为什么会这样呢?回声过程不应该停止吗?
发布于 2019-11-11 22:55:39
以下是termios(3)手册中的内容:
TOSTOP将SIGTTOU信号发送给background进程的进程组,该进程组试图写入its控制终端。
您的echo进程不是后台进程,也不尝试写入其控件tty。
还请注意"process“位;像SIGTTIN、SIGTTOU、SIGINT等作业控制信号被发送到整个进程组/作业,而不仅仅是发送到有罪的进程;在foo | bar &这样的管道中,foo和bar都将被停止。
实际上,echo是一个内置的shell,它不作为一个单独的进程运行。
https://unix.stackexchange.com/questions/551473
复制相似问题