This is the mail archive of the cygwin@sourceware.cygnus.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]

Re: echo is wrong...


At 06:25 PM 4/8/98 +0900, Tsuyoshi Tada wrote:
>> > In the Linux
>> > 
>> > [nagyl@piheno nagyl]$ echo  "aaa"|od -c
>> > 0000000   a   a   a  \n
>> > 0000004
>> > 
>> > In the windows NT bash
>> > 
>> > bash-2.01$ echo aaa|od -c
>> > 0000000   a   a   a  \r  \n
>> > 0000005
>> > 
>> > 
>> > What the hell is the \r ????? 
>> 
>> In the DOS/Win32 world, text files have CR LF line endings, as opposed to
>> Unix's LF only.  Since echo generates text, it is simply following the
>> convention of the operating system and outputting a proper text file.
>
>I also hait this behavior because I want to do these sort of things:
>	tar cf - foo | rsh bar dd of=/dev/rst0 bs=20b
>Funny things is that I can do this operation under NT's command prompt
>without any problem, because tar manages to open pipes in binary mode.
>
>My question is why bash opens pipes in O_TEXT mode, just ignoring
>binmode switch.  In addition, what the exact purpose of binmode switch?
>If it's on, can we treat all files in O_BINARY mode without
>mounting all the necessary directory with text=binary ?
>
>I also couldn't find proper info. about glob switch. Any info. would
>be appreciated.
>--
>Tsuyoshi TADA <tsuyo@soe.ty.ihi.co.jp>
>Advanced Analysis Technology Group
>Ship & Offshore Eng. Dept, IHI
>Toyosu 2-1-1, Koto-ku, Tokyo 135, JAPAN
>Tel: 03-3534-3818  Fax: 03-3534-3880
>

b19* versions of bash (2.0.1) are hardcoded to force the pipes to be text
again.  I didn't even realize this myself until Sergey pointed it out.
He had recompiled a version to keep pipes as binary for b18 and I got so 
used to having it that way, I forgot Cygnus would change it back when I upgraded to b19!  I'm building a new bash now so the world is right again!;-)
This explains why what you did works from the DOS prompt and not from inside
bash.  I guess bash should really be changed to look at the bin setting in
CYGWIN32 environment variable so that this is more configurable...


Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      (781) 239-1053
8 Grove Street                          (781) 239-1655 - FAX
Wellesley, MA  02181                    http://www.rfk.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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