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

Re: Zsh noob: word-splitting headache



Clint Adams <clint@xxxxxxx> writes:

> >   for i in `foo`
> >     do something with $i
> >   done
> 
>   for i in ${(f)"$(foo)"}
>     do something with $i
>   done

I tend to prefer making foo print NUL-separated records and use:

  for i in ${(ps:\0:)"$(foo)"}
    do something with $i
  done

  works with such foos as "find . -print0"

Now, I can handle ANY filename, including the ones containing
newlines.

Phil.



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