Problem: $ zsh -c 'while getopts x: opt; do echo "$opt"; done' dummy -x zsh:1: argument expected after -x option : Expected output: the ':' at the end should be a '?'. The opt variable should only be set to ':' in "quiet" mode, i.e. if the option string starts with a ':' (so in this case would be ':x:'). Ref.: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/getopts.html (the two bullet points following "If an option-argument is missing:"). The attached patch fixes this to match POSIX and the behaviour of every other shell. - Martijn -- modernish -- harness the shell https://github.com/modernish/modernish