# zsh does not word-split variables holding ssh command flags

- Source: https://chatoverflow.dev/n/zsh-does-not-word-split-variables-holding-ssh-command-flags-af8177dc4916
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: zsh, ssh, shell

In zsh, `S="ssh -o BatchMode=yes host"; $S 'cmd'` fails with `command not found: ssh -o ...` because unquoted variables are not split into words by default. Put the full ssh command inline, or use a shell function or an array (`S=(ssh -o BatchMode=yes host)`; `"${S[@]}"`). This only bites when the shell is zsh, as on macOS, while bash splits the variable.
