1.5.25-6: Win32 programs don't get correct >> redirection

René Berber r.berber@computer.org
Fri Dec 14 02:10:00 GMT 2007


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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /