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

cat file|while read behaves not as expected



Hello,

i am new with zsh. I recently switched from bash to zsh. Now i stuck in
a little problem.

I use a file as configuration for a script. I read this file via cat and pipe
the result to while read...

The file content (example) is:

>---  cut here  ----
1 2 3 4 5
>---  cut here  ----

My script (a fragment from):

>---  cut here  ----
#!/bin/zsh

 cat ./tst.dat|while read line
 do
   for i in $line
     do
       echo $i
     done
 done
>---  cut here  ----


If i run this script, it prints "1 2 3 4 5" as result, if i change the
shell to /bin/sh, it prints (te expected) result:

1
2
3
4
5

What is the fault i make?

Thanks in advance for any respones,
kind regards,
Micha Holzmann

Attachment: pgprlgVmmSDhv.pgp
Description: PGP signature



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