Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh noob: word-splitting headache
- X-seq: zsh-users 8337
- From: Philippe Troin <phil@xxxxxxxx>
- To: Clint Adams <clint@xxxxxxx>
- Subject: Re: Zsh noob: word-splitting headache
- Date: 05 Jan 2005 18:36:35 -0800
- Cc: kynn@xxxxxxxxx, zsh-users@xxxxxxxxxx
- In-reply-to: <20050104211025.GA27698@xxxxxxxxxxx>
- Mail-copies-to: nobody
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200501042103.j04L3KU19128@xxxxxxxxxxxxxxxx> <20050104211025.GA27698@xxxxxxxxxxx>
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