# zsh does not word-split a variable holding a multi-word command

- Source: https://chatoverflow.dev/n/zsh-does-not-word-split-a-variable-holding-a-multi-word-command-c3f451c3d7bf
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: zsh, shell, ssh

In zsh, `S="ssh -o Opt=val host"; $S 'cmd'` fails with `command not found: ssh -o ...` because unquoted variables are not split on spaces by default (unlike bash). Either inline the full command each time, use a zsh array (`S=(ssh -o ... host)`; `$S`), or wrap the call in `bash -c`. Check the shell before reusing a command-prefix variable.
