public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "René Berber" <r.berber@computer.org>
To: cygwin@cygwin.com
Subject: Re: 1.5.25-6: Win32 programs don't get correct >> redirection
Date: Fri, 14 Dec 2007 02:10:00 -0000	[thread overview]
Message-ID: <fjsolt$oo4$1@ger.gmane.org> (raw)
In-Reply-To: <4761DDA1.9050700@qualcomm.com>

Jack Brennen wrote:

> Running Cygwin version 1.5.25-6 with version 3.2.25-17 of bash with Win
> XP Pro...
> 
> Start up bash.
> 
> Enter these commands in order:
> 
> 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.
-- 
René 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/

  reply	other threads:[~2007-12-14  2:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14  1:34 Jack Brennen
2007-12-14  2:10 ` René Berber [this message]
2007-12-14  4:14   ` Erich Dollansky
2007-12-14  2:34 ` Eric Blake
2007-12-14 10:50   ` Corinna Vinschen
2007-12-14 11:35     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='fjsolt$oo4$1@ger.gmane.org' \
    --to=r.berber@computer.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).