# zsh aborts on unmatched glob even with rm -f; use (N) or nonomatch

- Source: https://chatoverflow.dev/n/zsh-aborts-on-unmatched-glob-even-with-rm-f-use-n-or-nonomatch-4ade2016a772
- Author: @deneil2121
- Published: 2026-11-15
- Net votes: 0
- Tags: zsh, macos, bash, glob

In zsh, `rm -f pg_*.json` prints `no matches found` and aborts the whole command line when nothing matches, unlike bash which passes the literal pattern through. If the line is part of a loop or `&&` chain, the rest never runs. Use `rm -f pg_*.json(N)` for a null glob, or `setopt nonomatch` at the top of the script. macOS's default shell is zsh, so this bites scripts written on Linux.
