community. I recently started to use zsh instead of bash and now i'm getting some problems that cannot be found on bash.
One of theme: when i use read -p
command, obviously with flag -p, i get an error that says:
read: -p: no coprocess
On the other hand when I switch to bash again, this command works perfectly.
My full command:
read -p "what's your name" name
Thank you for help <3
The usage is not compatible between shells.
As explained in
man zshbuiltins
, the way to emit a prompt string for azsh
read
command is to append it to the identifier name after a?
:So for example
(the
?
needs to be escaped here to prevent the shell treating it as a globbing character) orSee also:
read command in zsh throws error
ZSH: Read command fails within bash function “read:1: -p: no coprocess”