This is the mail archive of the cygwin 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: 1.5.25-6: Win32 programs don't get correct >> redirection


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/


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