Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: lines to array



On 14/02/07, Matt Wozniski <godlygeek@xxxxxxxxx> wrote:
On 2/13/07, Meino Christian Cramer wrote:
>  I am looking for a zsh-like way to put each line of the output for
>  example 'ls -l' into an array.
>  Is this possible without "looping" ?
>

How about this:
array=( "${(f)$(ls -l)}" )

That should work.

So this is the zsh-way... And I was wondering in the last few days how
to do this. (I finally ended up using for and changed IFS.)

Could you please explain what ${(f)...} actually does? Is there some
kind of parameter expansion going on?

~Matt

Regards
Christian (Walther)



Messages sorted by: Reverse Date, Date, Thread, Author