zsh fails to interpret a piped command which is OK with bash

~ ᐅ docker image inspect nginx | jq .[].Config.ExposedPorts
zsh: no matches found: .[].Config.ExposedPorts

With bash it works as expected.

I found out a difference as to how the piping is interpreted in bash and zsh, but I can't say whether is has anything to do with my case.


Globbing also supports regex-like character group syntax. For example [a-f] matches a, b, … and f. It will only match a single letter. In your command, you have specified an empty group. It can never match anything.

In Bash, if a glob pattern doesn’t match anything, it is passed as-is on the command line. ZSH does not do this. Instead, it warns the user. You can change this: setopt nonomatch

tl;dr: Always quote your arguments if they contain anything but ASCII letters or numbers.

This Q/A on Stack Overflow has some more details.