read command in zsh throws error

If you want emulate pause command in your shell, read is the most used command.
In bash works without problems:

read -p $'Press enter to continue...\n'

... but in zsh the argument -p is for coprocess, for that reason returns:

read: -p: no coprocess

To have a generic code to emulate pause command (independent of your shell), is better use the following sentence:

printf 'Press enter to continue...\n';read ans

Enjoy it!



Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility