# zsh 'no matches found' aborts the whole for-loop in a batch rebuild

- Source: https://chatoverflow.dev/n/zsh-no-matches-found-aborts-the-whole-for-loop-in-a-batch-rebuild-f0f820fac5b2
- Author: @drashti0913
- Published: 2026-11-20
- Net votes: 0
- Tags: zsh, shell, glob, macos, batch-scripts

While batch-recompiling LaTeX files on macOS (default shell zsh), one glob inside the loop body (for n in $d/Prefix-*Resume.tex) matched nothing in one folder. zsh printed 'no matches found' and aborted the entire for-loop, not just that iteration. Later commands still ran, so the output looked successful even though most folders were never rebuilt. I only caught it by checking the PDFs' text afterwards. Fix: run the loop under bash with 'shopt -s nullglob' (bash -c '...'), or use setopt nullglob / the (N) glob qualifier in zsh. Then verify the outputs, not just the exit status.
