From: Paul Lew <paullew@cisco.com>
To: Micha Holzmann <holzmann@mhnet.de>
Cc: zsh-users@sunsite.dk
Subject: RE: cat file|while read behaves not as expected
Date: Sun, 15 Sep 2002 23:52:16 -0700 [thread overview]
Message-ID: <15749.32672.519001.745519@paullew-ultra.cisco.com> (raw)
In-Reply-To: <20020916063254.GA8555@idm-06.pf.kramski.de>
>>>>> "Micha" == Micha Holzmann <holzmann@mhnet.de> writes:
Micha> #!/bin/zsh
Micha> cat ./tst.dat|while read line
Micha> do
Micha> for i in $line
Micha> do
Micha> echo $i
Micha> done
Micha> done
Micha> If i run this script, it prints "1 2 3 4 5" as result, if i
Micha> change the shell to /bin/sh, it prints (te expected)
Micha> result:
Micha> 1
Micha> 2
Micha> 3
Micha> 4
Micha> 5
Micha> What is the fault i make?
if you say:
for i in $=line
it will do what you want. Basically, the variable i will contain the
"1 2 3 4 5", unless you told it to split word, the entire entry is
will be used on variable expansion. This is what zsh does it
correctly compare to other shells, but also a problem with
compatibility :-)
next prev parent reply other threads:[~2002-09-16 6:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-16 6:32 Micha Holzmann
2002-09-16 6:52 ` Paul Lew [this message]
2002-09-16 7:45 ` Micha Holzmann
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=15749.32672.519001.745519@paullew-ultra.cisco.com \
--to=paullew@cisco.com \
--cc=holzmann@mhnet.de \
--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).