Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh read -q broken on OSX?

Tags:

macos

zsh

I'm running % read -q, and then typing a single character which isn't y, Y or n. However, the value set in $REPLY isn't n, it is the character I typed.

The documentation for read -q explicitly says:

Read only one character from the terminal and set name to ‘y’ if this character was ‘y’ or ‘Y’ and to ‘n’ otherwise.

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.

Also, I've tried running under zsh -f, same results (i.e., I don't think it's in my init scripts).

Am I missing something?

like image 632
Yaniv Aknin Avatar asked Jan 03 '13 15:01

Yaniv Aknin


1 Answers

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.

like image 126
Bart Schaefer Avatar answered Oct 11 '22 14:10

Bart Schaefer