X-Spam-Check-By: sourceware.org Message-ID: <4574AE59.5080801@cygwin.com> Date: Mon, 04 Dec 2006 18:25:13 -0500 From: "Larry Hall (Cygwin)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061108 Fedora/1.5.0.8-1.fc4.remi Thunderbird/1.5.0.8 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: bash CRLF problems (I have read the recent announcement) References: <7794 DOT 1165273150 AT gemini DOT franz DOT com> In-Reply-To: <7794.1165273150@gemini.franz.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 Kevin Layer wrote: > I'm really perplexed by the following behavior: > > rfr AT mad64 ~ > $ cat -v foo1.sh > echo 8010 > foo1.out > > rfr AT mad64 ~ > $ cat -v foo2.sh > sh foo1.sh > version=`cat foo1.out` > echo ${version}.bar > foo2.out > cat -v foo2.out > > rfr AT mad64 ~ > $ sh foo2.sh > 8010^M.bar^M > > rfr AT mad64 ~ > $ mount > C:\cygwin\bin on /usr/bin type system (textmode) > C:\cygwin\lib on /usr/lib type system (textmode) > C:\cygwin on / type system (textmode) > c: on /c type system (textmode) > z: on /z type system (textmode) > > rfr AT mad64 ~ > $ > > > The (real) scripts involved run on non-Windows platforms, so putting > in `d2u' isn't an option. I'd rather not resort to `tr' either, since > I have a large number of places to fix. Large. > > The bug, IMO, is the assigment to version of `cat foo1.out` contains a > ^M. I'm on a text mount, so this is counter to what I thought would > happen. Time to adjust your expectations. ;-) Text mounts write CRNL as EOLs for all files that are not explicitly opened as binary (or text for that matter). Text mounts remove the CR from EOLs read from files that are not explicitly opened as binary (or text). 'cat' explicitly opens the file as binary. If you need it to work otherwise, write a simple wrapper. Or just do the easy thing and change your mode to 'binary' and run 'd2u' on your local versions of the scripts. This is most compatible with the majority of "non-Windows" platforms. ;-) -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 -- 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/