Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh noob: word-splitting headache
- X-seq: zsh-users 8331
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: kynn@xxxxxxxxx
- Subject: Re: Zsh noob: word-splitting headache
- Date: Tue, 4 Jan 2005 13:30:44 -0800 (PST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <200501042103.j04L3KU19128@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200501042103.j04L3KU19128@xxxxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Tue, 4 Jan 2005 kynn@xxxxxxxxx wrote:
> for i in `foo`
> do something with $i
> done
>
> fails, because i holds individual words instead of whole lines.
Use a different construct.
foo | while read i; do something with $i; done
This works nicely in zsh because zsh executes the right-hand-side of
pipelines in the current shell when it can. It might not work as well in
other shells, but other shells don't have Clint's suggested ${(f)...}
expansion either.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author