This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash 3.1.17(8) CR/LF problem


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]