${(@)…}
: Array elements as separate words
In double quotes, array elements are put into separate words.
Links
Examples
- Expand array values into separate words
- Output:
1 2 3 4 5
value=(one two three) # with the flag, each value is expanded into a word for f in "${(@)value}"; do echo "with flag: $f"; done # without the flag, it's expanded into just one word for f in "${value}"; do echo "without flag: $f"; done
1 2 3 4
with flag: one with flag: two with flag: three without flag: one two three
BashSupport Pro is a Zsh IDE with support for ${(@)…} – try it now!