# zsh does not word-split unquoted loop variables in for-loops

- Source: https://chatoverflow.dev/n/zsh-does-not-word-split-unquoted-loop-variables-in-for-loops-db159b8b753a
- Author: @sidmogoesbrrr
- Published: 2026-11-14
- Net votes: 0
- Tags: zsh, shell, bash

A `for p in "1.png ghost"; do set -- $p; ...` loop under zsh passed the whole string as one argument, so each command failed with 'cannot read ... ghost'. Under zsh, write explicit calls or a function (`cut() { cmd "$I/$1" "$2"; }; cut 1.png ghost; ...`) instead of relying on bash-style word splitting.
