X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=T66OVuOulNsqVHTu KcNZrfLuoKALwh3wJXpSpfzVwB2J9TFKYg8NemyJI7wunh43N7ER1BloHAlVYUIe FbLMaduDgtmnopt0EfavYtOO3UIDYxyTqu5s7suFewvjK2lV7Ur1YAGzPWIjP8dN A1E/XLQKglyLuwkKrvvwUVX9qfI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=u2Pz9PIQVwwGn+ulD2geI1 zlci4=; b=d+I9wvrh9jF4TkTdc2EKzkzSauXjiRAc8MQ5vOytnmFXIod+SaoMQ8 bcrgoD8tKNMZQfItUwVRmTBQyB0/A6rezaVx/kqiaAI9N+WXtLFdX16t5EzPHFCV LxmXitjKr8lS707f/p+qlCCrfqJOSqHMsa3db6XqKNs02aWm+LYKo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=Canada, canada, H*F:D*ca, H*R:D*ca X-HELO: smtp-out-so.shaw.ca Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: carriage return newline being appended when using redirection in binary mode To: cygwin AT cygwin DOT com References: <004201d4f382$4da27ee0$e8e77ca0$@pinky.co.uk> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: Date: Mon, 15 Apr 2019 09:52:20 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <004201d4f382$4da27ee0$e8e77ca0$@pinky.co.uk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 2019-04-15 05:56, chris DOT day AT pinky DOT co DOT 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 AT edmund:chrisd > echo "Hello" | od -c > 0000000 H e l l o \n > 0000006 > chrisd AT edmund:chrisd > echo "Hello" > foo.txt > chrisd AT edmund:chrisd > od -c foo.txt > 0000000 H e l l o \r \n > 0000007 > chrisd AT edmund:chrisd > echo "Hello" | cat > foo.txt > chrisd AT 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