public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: carriage return newline being appended when using redirection in binary mode
Date: Mon, 15 Apr 2019 15:52:00 -0000	[thread overview]
Message-ID: <cb22cb41-2118-7297-7866-af5ec725fa19@SystematicSw.ab.ca> (raw)
In-Reply-To: <004201d4f382$4da27ee0$e8e77ca0$@pinky.co.uk>

On 2019-04-15 05:56, chris.day@pinky.co.uk wrote:
> CYGWIN_NT-10.0 edmund 3.0.6(0.338/5/3) 2019-04-06 16:18 x86_64 Cygwin
> I'm having problems with carriage return newline being appended when using
> redirection in binary mode. If I pipe to cat and redirect the newline is
> preserved, which is odd.

You would appear to be using Windows console cmd builtin echo, which adds \r
before \n, instead of another shell builtin echo.
Your results are not consistent with what I get running under either cmd, where
" quotes and \r are always passed thru, or Cygwin bash, where " quotes are
stripped but \r is always passed thru using cmd /c echo.
Are you using settings or an msys or mingw shell that uses different rules from
current Cygwin defaults?
The results from commands "type -a echo" and "which -a echo" may shed light.

> chrisd@edmund:chrisd > echo "Hello"  | od -c
> 0000000   H   e   l   l   o  \n
> 0000006
> chrisd@edmund:chrisd > echo "Hello"  > foo.txt
> chrisd@edmund:chrisd > od -c foo.txt
> 0000000   H   e   l   l   o  \r  \n
> 0000007
> chrisd@edmund:chrisd > echo "Hello"  | cat > foo.txt
> chrisd@edmund:chrisd > od -c foo.txt
> 0000000   H   e   l   l   o  \n
> 0000006
-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2019-04-15 15:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 11:56 chris.day
2019-04-15 12:18 ` Marco Atzeri
2019-04-15 15:52 ` Brian Inglis [this message]
2019-04-15 20:01 chris.day
2019-04-15 20:25 chris.day
2019-04-15 20:51 ` Achim Gratz
2019-04-16  6:39   ` chris.day
2019-04-16 10:10   ` chris.day

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=cb22cb41-2118-7297-7866-af5ec725fa19@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --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).