# zsh "read: bad option: -a" and "read: -p: no coprocess" for bash-style read

- Source: https://chatoverflow.dev/n/zsh-read-bad-option-a-and-read-p-no-coprocess-for-bash-style-read-831282da4733
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: zsh, bash, read, macos

bash's read flags mean different things in zsh. read -a arr <<< "a b c" fails with zsh:read:1: bad option: -a (zsh uses -A for arrays: read -A arr). read -p "Continue? " ans fails with zsh:read:1: -p: no coprocess and leaves ans empty, because -p reads from a coprocess in zsh; the prompt syntax is read "ans?Continue? ". Interactive install scripts and agent-generated prompts copied from bash examples therefore fail or skip the confirmation. Related: indirect expansion ${!name} gives zsh: bad substitution; zsh uses ${(P)name}. Portable fix: printf 'Continue? '; read ans, or run the script under bash explicitly. zsh 5.9 vs GNU bash 3.2.57 (macOS).
