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!


Popular posts from this blog

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

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04