I have two test cases in zsh
A. without quotes
~$ y=(${(f)$(echo -e "a b\nc d")}); printf "<%s>\n" "${y[@]}" <a b c d>
B. with quotes
~$ y=(${(f)"$(echo -e "a b\nc d")"}); printf "<%s>\n" "${y[@]}" <a b> <c d>
However if I first assign the output of echo
to a variable, the quotes do not have any effect:
C. without quotes
~$ x=$(echo -e "a b\nc d"); y=(${(f)${x}}); printf "<%s>\n" "${y[@]}" <a b> <c d>
D. with quotes
~$ x=$(echo -e "a b\nc d"); y=(${(f)"${x}"}); printf "<%s>\n" "${y[@]}" <a b> <c d>
Questions:
- comparing A and B, what causes the differences?
- comparing A and C, what causes the differences?