delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/13/21:10:45

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: =?ISO-8859-1?Q?Ren=E9_Berber?= <r DOT berber AT computer DOT org>
Subject: Re: 1.5.25-6: Win32 programs don't get correct >> redirection
Date: Thu, 13 Dec 2007 20:10:00 -0600
Lines: 37
Message-ID: <fjsolt$oo4$1@ger.gmane.org>
References: <4761DDA1 DOT 9050700 AT qualcomm DOT com>
Mime-Version: 1.0
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
In-Reply-To: <4761DDA1.9050700@qualcomm.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Jack Brennen wrote:

> Running Cygwin version 1.5.25-6 with version 3.2.25-17 of bash with Win
> XP Pro...
>=20
> Start up bash.
>=20
> Enter these commands in order:
>=20
> sh-3.2$ echo ABCDEFGHIJKLMNOPQRST > foo.txt
> sh-3.2$ echo UVWXYZ >> foo.txt
> sh-3.2$ cat foo.txt
> ABCDEFGHIJKLMNOPQRST
> UVWXYZ
> sh-3.2$ echo ABCDEFGHIJKLMNOPQRST > foo.txt
> sh-3.2$ cmd /c echo UVWXYZ >> foo.txt
> sh-3.2$ cat foo.txt
> UVWXYZ
> IJKLMNOPQRST
[snip]

What you don't see is that Windows' echo added a CR so you get to see
the second line followed by CR-LF and the rest of the (overwritten)
first line.

You can delete the CR and get the correct output, for instance using:

cmd /c echo UVWXYZ | tr -d "\r" >> foo.txt

Or directly with something like:

cmd /c echo UVWXYZ | tr -d "\r" | od -t x1z

take out the translate part to see the CR-LF.
--=20
Ren=E9 Berber


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019