This is the mail archive of the 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]

Re: binary mode from non-Cygwin shells?

--- Antony Courtney <> wrote:
> However, if I run the same command from the Windows "Command Prompt"
> (, I see:
> d:\users\antony>echo hello |od -c
> 0000000000     h   e   l   l   o      \r  \n
> 0000000010
> which seems to be inconsistent with the User's Guide.  The User's Guide
> (
> states:
> 	[...] Non-Cygwin shells always pipe and redirect with binary mode.
> I can, of course, do a "set CYGWIN=binmode" from within the "Command Prompt",
> and then I'll get the same output from the Command Prompt as I do from bash,
> but
> that's a somewhat clumsy solution (particulary for the case I'm interested in
> --
> a non-Cygwin Windows application spawning Cygwin's OpenSSH ssh client using
> ordinary Win32 API calls).
> Any thoughts?  Is this a bug in Cygwin, a bug in the User's Guide, or am I
> just confused?

You're confused.  Echo is a shell builtin even for is
writing the output in text mode and od is reading the input in binary mode. 
You will find that if you set CYGWIN=nobinmode before executing your example od will read in text mode and the \r will be eliminated. 
Or, if you use the echo executable found in the Cygwin/bin directory instead of
the shell builtin the \r will not be written.


Earnie Boyd

---         <>         ---
--- Cygwin: POSIX on Windows <> ---
---   Minimalist GNU for Windows <>   ---

Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.

Want to unsubscribe from this list?
Send a message to

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