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

Zsh noob: word-splitting headache

I'm writing this script in which, among other things, I want to do
something for each line output by some command foo.  The problem is
that the lines output by foo contain whitespace (e.g. "bar baz
frobozz"), so a construct like this

  for i in `foo`
    do something with $i

fails, because i holds individual words instead of whole lines.

I've tried every trick I can think of to prevent the intra-line
word splitting while still allowing the inter-line splitting, but
nothng has worked.  What's the right way to do this?

I looked at the FAQ at http://zsh.sunsite.dk/FAQ for an answer to this
question (as well as the Zsh Manual, the Zsh User Guide, and "From
Bash to Z-Shell", but no luck.

BTW, of all the difficulties I have programming zsh (or any shell for
that matter), a great many of them are in one way or another related
to word splitting.  Is there a *programming* FAQ on zsh word



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