简体   繁体   English

在OSX上zsh读-q坏了吗?

[英]zsh read -q broken on OSX?

I'm running % read -q , and then typing a single character which isn't y , Y or n . 我正在运行% read -q ,然后输入一个不是yYn的单个字符。 However, the value set in $REPLY isn't n , it is the character I typed. 但是, $REPLY设置的值不是n ,而是我输入的字符。

The documentation for read -q explicitly says: read -q文档明确说:

Read only one character from the terminal and set name to 'y' if this character was 'y' or 'Y' and to 'n' otherwise. 只读取终端中的一个字符,如果此字符为“y”或“Y”,则将名称设置为“y”,否则设置为“n”。

This behavior reproduces on OSX 10.7 using zsh 4.3.11 (default) and 5.0.0 (Homebrew), but not on Linux (Ubuntu 12.04, zsh 4.3.10) - on Linux, the value in $READ is n , as expected. 此行为在OSX 10.7上使用zsh 4.3.11(默认)和5.0.0(Homebrew)重现,但在Linux上不重现(Ubuntu 12.04,zsh 4.3.10) - 在Linux上, $READ值为n ,如预期的那样。

Also, I've tried running under zsh -f , same results (ie, I don't think it's in my init scripts). 此外,我尝试在zsh -f下运行,结果相同(即,我不认为它在我的init脚本中)。

Am I missing something? 我错过了什么吗?

This is indeed a bug, and has been for two and a half years. 这确实是一个错误,已经有两年半了。 It was inadvertently lost by the patch in zsh-workers article 27188. Patch in article 30949. zsh-workers文章27188中的修补程序无意中丢失了它。修补程序在第30949条中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM