From: <kynn@panix.com>
To: zsh-users@sunsite.dk
Subject: Zsh noob: word-splitting headache
Date: Tue, 4 Jan 2005 16:03:20 -0500 (EST) [thread overview]
Message-ID: <200501042103.j04L3KU19128@panix3.panix.com> (raw)
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
done
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
splitting?
Thanks!
kj
next reply other threads:[~2005-01-04 21:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-04 21:03 kynn [this message]
2005-01-04 21:10 ` Clint Adams
2005-01-04 21:35 ` kynn
2005-01-06 2:36 ` Philippe Troin
2005-01-04 21:30 ` Bart Schaefer
2005-01-07 12:03 ` Stephane Chazelas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200501042103.j04L3KU19128@panix3.panix.com \
--to=kynn@panix.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).