delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/29/02:15:49

X-Spam-Check-By: sourceware.org
Message-ID: <860934040609282315i1f0a85ccua1c7a48848ae25e9@mail.gmail.com>
Date: Thu, 28 Sep 2006 23:15:33 -0700
From: "Malcolm Nixon" <malcolm DOT nixon AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Bash 3.1.17(8) CR/LF problem
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eric Blake wrote:
>> #!/bin/sh
>> IFS=' ''	''
>> ' # Yes, that was a space, tab, and line ending
> I retract this suggestion.  On further investigation, bash currently does
> not treat \r as an IFS whitespace character, and the hacks to the source
> to make this happen are too invasive for my liking.  Adding \r to IFS will
> impact your script, but the impact is incomplete, and it does not ignore
> \r at the end of all lines.

I spent some time looking at this. It turns out that solution mostly works,
however using comment characters for line ends also works. E.G:
    #!/bin/sh<CR><LF>
    echo "This script works"   #<CR><LF>
    echo "without causing any" #<CR><LF>
    echo "errors in Bash."     #<CR><LF>

Considering this, I tried writing a top-level bash script of the form:
    #!/bin/sh<CR><LF>
    mount -t "$(cygpath -aw .)" "$(cygpath -au .)"  #<CR><LF>
    ./crlf_scipt.sh                                 #<CR><LF>
    umount "$(cygpath -au .)"                       #<CR><LF>

The problem I'm finding now is that for the context of ./crlf_script.sh
(when executed from /cygdrive/c/junk) my mount points are:
    c:\cygwin\bin on /usr/bin type system (binmode)
    c:\cygwin\lib on /usr/lib type system (binmode)
    c:\cygwin on / type system (binmode)
    c:\junk on /cygdrive/c/junk type system (textmode)   <----
    c: on /cygdrive/c type system (binmode,noumount)
    d: on /cygdrive/d type system (binmode,noumount)

So all looks good, my current directory is mounted as textmode.
Unfortunately my crlf_script.sh is still executed with no textmode
translation. I'm guessing it's hitting the /cygdrive/c mount and
deducing binary before seeing /cygdrive/c/junk.

Any ideas?

-Malcolm

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019