Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <779F20BCCE5AD31186A50008C75D9979171783@silldn_mail1.sanwaint.com> From: "Fifer, Eric" To: cygwin AT sourceware DOT cygnus DOT com Subject: RE: CR/LF and read is shell scripts Date: Fri, 18 Aug 2000 15:38:51 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id KAA13861 Eirik_Nordbrøden wrote: > The script generates a temporary file by the use of the echo > statement and later on the content is evaluated with a cat and consecutive > read statements. The problem is that the generated file contains CRLF at the > end of each line, but the read statement only recognises the LF and therefore > adds CR to the last variable read. The behavior of cat seems to have changed (presumably after the textutils-2.0 upgrade on 7/8). Formerly, it performed CR/LF mapping based on the binary/text mode of the input file. Now it is always in binary mode, unless you're adding numbers (or other non-verbatim options). In these examples x has "hello\r\n": $ od -c x 0000000 h e l l o \r \n 0000007 On binary mount: $ cat x | od -c 0000000 h e l l o \r \n 0000007 $ cat -n x | od -c 0000000 1 \t h e l l o \r \n 0000016 On text mount: $ cat x | od -c 0000000 h e l l o \r \n 0000007 $ cat -n x | od -c 0000000 1 \t h e l l o \n 0000015 There are old threads discussing how people disliked the text behavior of cat. However, I think the old behavior of cat should be restored. And, for those who need binary behavior there is now a -B/--binary option. Any other opinions? Eric Fifer -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com