con*_*gus 21 terminal echo stty
有时,当脚本在密码提示下被杀死时,我再也看不到我的输入在终端中被回显了。也就是说,通常在终端上,我看到的是:
$ _
<after typing 'foobar':>
$ foobar_
Run Code Online (Sandbox Code Playgroud)
但在这种情况下,我看不到我输入的内容。
我知道我可以重新启动终端以恢复其常规设置,但是有没有办法在不重新启动的情况下恢复输入回声?
Xen*_*050 32
对于 bash,我通常只输入reset并修复任何“有趣”的东西。看起来它也被称为tset但调用每个会做一些不同的事情。
tset, reset - terminal initialization
When invoked as reset, tset sets cooked and echo modes, turns off
cbreak and raw modes, turns on newline translation and resets any unset
special characters to their default values before doing the terminal
initialization described above. This is useful after a program dies
leaving a terminal in an abnormal state. Note, you may have to type
<LF>reset<LF>
(the line-feed character is normally control-J) to get the terminal to
work, as carriage-return may no longer work in the abnormal state.
Also, the terminal will often not echo the command.
Run Code Online (Sandbox Code Playgroud)
con*_*gus 15
使用stty命令。具体来说,运行以下命令:
stty echo
Run Code Online (Sandbox Code Playgroud)
这将恢复可能在密码提示期间关闭的 echo(打印输入字符)。
要查看所有终端设置,请运行stty -a. 当输入被隐藏时,它应该显示-echo在输出的某个地方。修复后,它应该显示echo在它的位置。
| 归档时间: |
|
| 查看次数: |
11442 次 |
| 最近记录: |