This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Read not honouring "-r"?


I wrote:
> This seems to be particularly tied to ksh, and specifically
> when you use "<" to redirect a file. If you simply pipe the
> output of grep to the while loop, it works. Interestingly,
> sh, bash, and zsh all give the behavior you were expecting.

I couldn't resist trying it out on my Linux box, which runs
the same version of pdksh as my Cygwin install. Even more
interestingly, it works as you were expecting on Linux as
well. So this looks like a problem with the Cygwin port of
pdksh.

This simpler test case demonstrates it pretty clearly:

--test.sh--
dos2unix foo.txt
while read x; do echo "$x"; done < foo.txt
unix2dos foo.txt
while read x; do echo "$x"; done < foo.txt
--foo.txt--
1
2
3
----

Run under various shells:

$ sh test.sh    # zsh and bash yield same result
foo.txt: done.
1
2
3
foo.txt: done.
1
2
3
$ ksh test.sh   # this one fails for DOS endings
foo.txt: done.
1
2
3
foo.txt: done.
1


$ _

gsw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]