&是什么QUOT; stty的原料-echo"做OS X [英] What does "stty raw -echo" do on OS X

查看:157
本文介绍了&是什么QUOT; stty的原料-echo"做OS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试: $ stty的原料-echo 在我的终端(在OS X 10.6的Bash)。它stringe的东西,这就像终端挂在那里。然后我查找手册:

When I try: $ stty raw -echo on my Terminal (Bash on OS X 10.6). It does stringe things and it's like the terminal hang there. Then I lookup the manual:

RAW(-raw)

如果设置,改变该终端的模式,因此没有输入或搜索
  进行输出处理。如果不设置,改变的模式
  终端执行输入和输出一些合理的状态
  处理。注意,由于该终端驱动程序不再具有
  单张RAW位,这是不可能的直觉分别设置什么标志
  之前设定的原始。这意味着,你重置生可能无法放回
  一切都是previously生效的设置。要设置终端
  到原始状态,然后准确地恢复它,下面的shell
  建议code:

If set, change the modes of the terminal so that no input or
output processing is performed. If unset, change the modes of the terminal to some reasonable state that performs input and output processing. Note that since the terminal driver no longer has a single RAW bit, it is not possible to intuit what flags were set prior to setting raw. This means that unsetting raw may not put back all the setting that were previously in effect. To set the terminal into a raw state and then accurately restore it, the following shell code is recommended:

save_state=$(stty -g)
stty raw
...
stty "$save_state"              


  
  

回声(-echo)

回显(不回显)的每一个字符输入。

Echo back (do not echo back) every character typed.

所以它应该把原始模式终端,然后返回我输入的是什么?可能有人请解释一下这是什么命令呢?而有什么区别时,参数有几许,例如原材料 -raw ?他们是否意味着samething?是否有我可以学习这个的任何资源?

So it's supposed to turn the Terminal in raw mode then return what I type in as is? Could someone please explain what does this command do? And what is the difference when an argument has dash, e.g. raw and -raw? Are they mean the samething? Is there any resource I could learn this?

推荐答案

首先,破折号表示禁用设置。因此,这使得呼应:

Firstly, the dash means "disable" a setting. So this enables echoing:

stty echo

这禁用它:

stty -echo

当你禁用它,你的打字不回显给你,这就是为什么它好像在终端悬挂。尝试的stty -echo 然后键入 LS 和preSS回报 - 你仍然会看到<$ C的输出$ C> LS 。

When you disable it, your typing is not echoed back to you, which is why it seems as if the terminal is hanging. Try stty -echo then type ls and press return - you will still see the output of ls.

原材料设置意味着输入和输出不处理,就直接通过发送。能加工之类的东西忽略某些字符,字符转换成其他字符,使中断信号等于是用 stty的原料你不能按Ctrl-C结束进程,例如。

The raw setting means that the input and output is not processed, just sent straight through. Processing can be things like ignoring certain characters, translating characters into other characters, allowing interrupt signals etc. So with stty raw you can't hit Ctrl-C to end a process, for example.

这篇关于&是什么QUOT; stty的原料-echo&QUOT;做OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆