« Return to Thread: CR/LF problems after upgrade

Re: CR/LF problems after upgrade

by fschmidt :: Rate this Message:

Reply to Author | View in Thread

from http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html

2. d2u is your friend.  You can use it to convert any problematic script
into binary line endings.
Several people I work with, who are even less technical than I am, use cygwin and edit scripts with various editors.  So this will not work.

3. Cygwin text mounts automatically work with either line ending style,
because the \r is stripped before bash reads the file.  If you absolutely
must use files with \r\n line endings, consider mounting the directory
where those files live as a text mount.  However, text mounts are not as
well tested or supported on the cygwin mailing list, so you may encounter
other problems with other cygwin tools in those directories.
I don't know what mounts are, or how to use them.

4c. To affect all scripts, export the environment variable BASH_ENV,
pointing to a file that sets the shell option as desired.  Bash will
source this file on startup for every script.
I tried:

cd /etc
echo '(set -o igncr) 2>/dev/null && set -o igncr; # comment is needed' >bash_env
export BASH_ENV=/etc/bash_env

This did not work.

4d. Added in the bash-3.2-2 release: export the environment variable
SHELLOPTS with igncr included in it.  It is read-only from within bash,
but you can set it before invoking bash; once in bash, it auto-tracks the
current state of 'set -o igncr' or 'shopt -s igncr'.  If exported, then
all bash child processes inherit the same option settings.
I tried:

export SHELLOPTS=$SHELLOPTS:igncr

and got:

bash: SHELLOPTS: readonly variable

5. You can also experiment with the IFS variable for controlling how bash
will treat \r during variable expansion.
I don't know what the IFS variable is, or how to use it.

 « Return to Thread: CR/LF problems after upgrade