Delivered-To: listarch-cygwin AT sourceware DOT cygnus DOT com Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Delivered-To: uwin-users AT research DOT att DOT com Message-ID: <36C33BA2.9143FE90@erols.com> Date: Thu, 11 Feb 1999 15:20:50 -0500 From: Bruce Lilly Organization: Bruce Lilly X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Luke Kendall , "uwin-users AT research DOT att DOT com" Subject: Re: sh read mis-handling CR/LF? References: <199902102237 DOT JAA24580 AT tosh DOT research DOT canon DOT com DOT au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-uwin-users AT research DOT att DOT com > ---------- > From: Bruce Lilly > Sent: 1999年2月12日 5:20:50 > To: Luke Kendall; uwin-users AT research DOT att DOT com > Subject: Re: sh read mis-handling CR/LF? > Auto forwarded by a Rule > Luke Kendall wrote: > > This is under Windows NT 4.0 sp4, U/WIN 2.0b1. > > Surely the shell's read function should not be opening files > in binary mode? Surely it should be stripping the CR and LF from > the end of the input line? > > I think the stuff below speaks for itself. Please let me know > if I'm confused here. > > ---- test-here script ----- > #!/bin/sh > cat <<-'EOF' > test-input > test-1 > EOF > read f rest < test-input > if [ "$f" = "test-1" ] > then > echo "Read matches" > else > echo "Read mis-match" > fi > > echo "od of input file:" > od -c test-input > echo "od of input line re-echoed:" > echo "$f$rest" | od -c > ---------- end ----------- OK (you asked for it!) you're confused. You need to eliminate the whitespace before the "test-1" and "EOF" lines for starters. Having made that correction and run the script, I get the following output here (also NT 4.0 SP4 and U/WIN 2.0Beta1, with msvcrt.dll version 6.00.8337.0): Read matches od of input file: 0000000 t e s t - 1 ¥n 0000007 od of input line re-echoed: 0000000 t e s t - 1 ¥n 0000007 Note that I/O results may vary with the version of msvcrt.dll on your system, as I posted a week and a half ago (titled "¥015 before newline"). The version of msvcrt.dll mentioned above is available from http://www.microsoft.com/ntserver/nts/downloads/recommended/MFCLibrary/default.asp (it works on NT Server or workstation or non-NT MS-Windows). Microsoft says it "resolves an issue that can cause some third party software to behave unexpectedly." And that pretty much sums up your experience. ____________________________________________________________ If you need help unsubscribing or using this list in general, send mail to owner-uwin-users AT research DOT att DOT com To unsubscribe from this list, please send the following two-line message to majordomo AT research DOT att DOT com, in which your_email_address should be replaced by the address you used when you subscribed to the list: unsubscribe uwin-users your_email_address end -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com