Get list from line delimited output

I want to get a ZSH list from line split output. In my case, from the following command:

ssh myhost ls /Applications

I tried $(ssh myhost ls /Applications), but it does not work (it breaks into spaces as well).

+3
source share
3 answers

lines=("${(@f)$(ssh myhost ls /Applications)}")

+2
source
${(ps.\n.)"$(ssh myhost ls /Applications)"}
0
source

myarray=(${(f)"$(ssh myhost ls /Applications)"});

0
source

Source: https://habr.com/ru/post/1758610/


All Articles