shell - How pipe to zsh read? -


with bash fine:

$ yes | bash -c 'read -sn 1 -p "[y/n] " response ; echo $response' y 

but zsh have trouble:

$ yes | zsh -c 'read -sk 1 "response?[y/n] " ; echo $response' [y/n] 

when -k option used, zsh's read command read terminal unless instructed otherwise. documented in appropriate section of zshbuiltins manpage. pipe supplying standard input script, has no effect on attempts read terminal.

you can add -u 0 call read tell read standard input (file descriptor 0) when other options (such -k) cause read elsewhere.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -