停止回显^ C到终端 [英] Stop echoing ^C to terminal
问题描述
如何告诉我的bash不要将^ C回显到终端?
How do I tell my bash to not echo ^C back to terminal?
如果我只是在bash会话中按Ctrl + C,则终端窗口中不会打印任何内容.但是,如果我使用Ctrl + C终止某些程序,有时会在我的终端中回显并打印^ C.有什么办法告诉我bash我根本不想回显^ C吗?
If I just hit Ctrl+C in bash session, nothing is printed in my terminal window. But if I terminate some program with Ctrl+C, sometimes ^C is echoed and printed in my terminal. Is there any way to tell my bash I do not want echoing back ^C at all?
推荐答案
好吧,我相信它实际上是在回显插入符号" -C,而不是 CTRL-C
字符.除此之外,这实际上是 tty
驱动程序的功能,而不是shell的功能.驱动程序实际上会截获 CTRL-C
字符,为进程生成 SIGINT
,然后回显这些字符.如果有办法在系统上执行此操作(这在很大程度上取决于操作系统),则会在 stty(1)手册页或 tty(4)驱动程序页面.
Well, I believe it's actually echoing "caret"-C, not the CTRL-C
character. Other than that, this is actually a function of the tty
driver, not the shell; the driver actually intercepts the CTRL-C
character, generates a SIGINT
to the process, and echos the characters. If there is a way to do it on your system (this will be heavily OS dependent) it would be documented in the stty(1) man page or the tty(4) driver page.
这篇关于停止回显^ C到终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!