This is the mail archive of the cygwin@cygwin.com 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: cygwin 1.3.12 problem with using pipes


I don't know whether this is related to your problem, but I've observed
the following behavior...

$ cat foo.sh
#!/bin/bash
foo="$(echo A;echo B;echo C;echo D)"
echo "${foo}" | od -c
echo
echo "${foo#????}" | od -c

$ ./foo.sh
0000000   A  \n   B  \n   C  \n   D  \n
0000010

0000000   C  \n   D  \n
0000004

$ ./foo.sh > /binmode-mount/foo.tmp && cat /binmode-mount/foo.tmp
0000000   A  \n   B  \n   C  \n   D  \n
0000010

0000000   C  \n   D  \n
0000004

$ ./foo.sh > /textmode-mount/foo.tmp && cat /textmode-mount/foo.tmp
0000000   A  \r  \n   B  \n   C  \n   D  \n
0000011

0000000   C  \r  \n   D  \n
0000005

Is that last one weird or what?  Clearly, the extraneous carriage return
comes in during the pipe to od, but only when the script's output is
redirected to a file under a textmode mount point and only the first
newline gets an extraneous carriage return.

I'm pretty sure I get the same thing regardless of whether I have
CYGWIN=binmode or CYGWIN=nobinmode.

Dave

-- 
David MacMahon, President
Smart Software Consulting
http://www.smartsc.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]