Subject: Re: CRLF in cat output breaks scripts.
From: [email-masked] (Michael Weiser)

15 Sep 1998 02:58:43 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
To: Larry Hall <[email-masked]>
Cc: [email-masked]

Hello Larry, you wrote:
>>>cat and other commands that use > to write files, put in CR's so that
>>>we end up with CRLF at the end of every line.
>>Just change to binary mounts (e.g. by setting fbinary under
>>HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL
>>Setup\b15.0\mounts\<nr> to 1 for all your mounts).
>Actually, this isn't going to fix this problem.  The bash that comes with 
>the distribution is set so that stdin, stdout, and pipes write in text mode.
>If you really want these to work as they should, you need to either get 
>the original bash source from a GNU archive or modify execute_cmd.c in the
>bash source provided by Cygnus and remove the _setmode() statements...
Really? I thought this only applies to pipes.

I just tried to do the following with Image4.png being a binary file:

cat Image4.png | cat >test2.txt

Like one would expect I get

michael@NARGOTHROND:/mnt/f/home/michael >cat Image4.png | cat
>test2.txt
Broken pipe
michael@NARGOTHROND:/mnt/f/home/michael >l
-rw-r--r--   1 michael  Kein        17035 Sep 14 02:27 Image4.png
-rw-r--r--   1 michael  Kein         3879 Sep 14 05:08 test2.txt

But when I do cat Image4.png >test2.txt I get

michael@NARGOTHROND:/mnt/f/home/michael >cat Image4.png >test2.txt
michael@NARGOTHROND:/mnt/f/home/michael >l
-rw-r--r--   1 michael  Kein        17035 Sep 14 02:27 Image4.png
-rw-r--r--   1 michael  Kein        17035 Sep 14 05:10 test2.txt
michael@NARGOTHROND:/mnt/f/home/michael >

So are you sure?

mount says

michael@NARGOTHROND:/mnt/f/home/michael >mount
Device           Directory           Type        Flags
c:\temp          /tmp                native      text=binary
f:               /mnt/f              native      text=binary
e:               /mnt/e              native      text=binary
d:               /mnt/d              native      text=binary
g:               /mnt/cd             native      text=binary
c:               /mnt/c              native      text=binary
f:\home          /home               native      text=binary
\\.\tape1:       /dev/st1            native      text=binary
\\.\tape0:       /dev/st0            native      text=binary
\\.\b:           /dev/fd1            native      text=binary
\\.\a:           /dev/fd0            native      text=binary
e:\dev\cygwin32.b19 /                   native      text=binary
michael@NARGOTHROND:/mnt/f/home/michael >

for me and CYGWIN32 is set to 'binmode tty'.
-- 
bye, Michael
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".