X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: Read not honouring "-r"? Date: Thu, 21 Sep 2006 08:47:20 +0930 Message-ID: In-Reply-To: <4C89134832705D4D85A6CD2EBF38AE0F7B0E05@PAUMAILU03.ags.agere.com> From: "Irwin, Doug" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k8KNIEUT029466 Hi All, Gerald, you are gold! For some reason I expected to see ^M's in the file if it was DOS format. Opening filesystems.cfg in Ultraedit failed to prompt with "Do you want to convert filesystems.cfg to DOS format?", so it was DEFINITELY in DOS format (as if there is any doubt). Consequently running dos2unix on filesystems.cfg fixed it straight away. The other responses are very interesting too. Also - using "cat filesystems.cfg | while read" isn't an option because we need variables set inside the while loop to be visible outside it (oh the joys of porting existing Solaris scripts). Thanks everyone how made suggestions, etc. Interested to hear about anything else related. Best regards, -doug -----Original Message----- From: Williams, Gerald S (Jerry) [mailto:gsw AT agere DOT com] Sent: Tuesday, 19 September 2006 11:24 PM To: cygwin AT cygwin DOT com Subject: RE: Read not honouring "-r"? Doug Irwin wrote: > One would expect a "read -r fs t2 t3" to process this without > attempting to expand slashes. But I can't seem to get this bit > working... And I can't seem to find any doco on doing that in Cygwin. > > I've attached the files I am testing with in the hope that someone can > help me work this out. > > No doubt I have missed something rather obvious. "-r" has nothing to do with it: CR/LF line endings are the culprit. This seems to be particularly tied to ksh, and specifically when you use "<" to redirect a file. If you simply pipe the output of grep to the while loop, it works. Interestingly, sh, bash, and zsh all give the behavior you were expecting. So for the short term, run d2u on filesystems.cfg. If you plan to continue using ksh, you may want to follow up and try to understand the discrepancy--there may be an option that allows you to get the behavior you want (and if not, it may be worth having KSH's behavior changed to be more consistent with other shells, but that's something for the maintainer and/or upstream KSH support to decide). gsw -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/