From: <chris.day@pinky.co.uk>
To: <cygwin@cygwin.com>
Subject: RE: carriage return newline being appended when using redirection in binary mode
Date: Mon, 15 Apr 2019 20:01:00 -0000 [thread overview]
Message-ID: <006101d4f3c6$07126ff0$15374fd0$@pinky.co.uk> (raw)
In-Reply-To:
H Brian -
Output from type and which
chrisd@edmund:chrisd > type -a echo
/usr/bin/ksh: whence: -a: unknown option
chrisd@edmund:chrisd > which -a echo
/usr/bin/echo
/usr/bin/echo
This behaviour of the redirection can also be replicated using sed, etc.
chrisd@edmund:chrisd > od -c foo.txt
0000000 H e l l o \n
0000006
chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt | od -c
0000000 G o o d b y e \n
0000010
chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt > boo.txt
chrisd@edmund:chrisd > od -c boo.txt
0000000 G o o d b y e \r \n
0000011
Curious case of pipe to cat then redirect
chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt | cat > boo.txt
chrisd@edmund:chrisd > od -c boo.txt
0000000 G o o d b y e \n
0000010
chrisd@edmund:chrisd > echo $CYGWIN
nodosfilewarning codepage:utf-8 binmode
Cheers
Chris Day
c: +44 7930 909 297
p: +44 115 714 0869
s: bigchrisday
https://www.linkedin.com/in/chrisdayabinitio/
-----Original Message-----
From: chris.day@pinky.co.uk <chris.day@pinky.co.uk>
Sent: 15 April 2019 12:57
To: 'cygwin@cygwin.com' <cygwin@cygwin.com>
Subject: carriage return newline being appended when using redirection in
binary mode
Hi -
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.
CYGWIN_NT-10.0 edmund 3.0.6(0.338/5/3) 2019-04-06 16:18 x86_64 Cygwin
chrisd@edmund:chrisd > mount
E:/abinitio/cygwin/bin on /usr/bin type ntfs (binary,auto)
E:/abinitio/cygwin/lib on /usr/lib type ntfs (binary,auto)
E:/abinitio/cygwin on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)
E: on /cygdrive/e type ntfs (binary,posix=0,user,noumount,auto)
F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto)
G: on /cygdrive/g type ntfs (binary,posix=0,user,noumount,auto)
H: on /cygdrive/h type vfat (binary,posix=0,user,noumount,auto)
Q: on /cygdrive/q type ntfs (binary,posix=0,user,noumount,auto)
chrisd@edmund:chrisd > echo "Hello"
Hello
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
This does seem contrary to the following posts
https://sourceware.org/ml/cygwin/2017-02/msg00152.html
https://sourceware.org/ml/cygwin/2017-02/msg00188.html
https://sourceware.org/ml/cygwin/2017-02/msg00189.html
Cheers
Chris Day
c: +44 7930 909 297
p: +44 115 714 0869
s: bigchrisday
https://www.linkedin.com/in/chrisdayabinitio/
--
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
next reply other threads:[~2019-04-15 20:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 20:01 chris.day [this message]
-- strict thread matches above, loose matches on Subject: below --
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
2019-04-15 11:56 chris.day
2019-04-15 12:18 ` Marco Atzeri
2019-04-15 15:52 ` Brian Inglis
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='006101d4f3c6$07126ff0$15374fd0$@pinky.co.uk' \
--to=chris.day@pinky.co.uk \
--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).