Problems with line endings for shell scripts

Jurgen Defurne jurgen.defurne@gmail.com
Mon Feb 8 12:30:00 GMT 2010


Dear all,

I have the following mounts on my test & verification system for Cygwin 1.7.

C:/Documents and Settings on /home type ntfs (binary,exec)
C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
C:/local on /usr/local type ntfs (binary,exec)
B: on /cygdrive/b type cifs (binary,posix=0,user,noumount,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
E: on /cygdrive/e type cifs (binary,posix=0,user,noumount,auto)
H: on /cygdrive/h type netapp (binary,posix=0,user,noumount,auto)
Z: on /cygdrive/z type ntfs (binary,posix=0,user,noumount,auto)

Today I am having a problem with running a shell script (sh/bash)
which has CRLF endings. This is already an old script and has been
much used across Cygwin 1.3, 1.5. MontaVista 4.0 and Montavista 5.0.

After testing (because Perl does not have a problem), I found out that
there is a problem with empty lines in bash.

Here is my test case :

echo Line to echo

echo Another line

When running this, I get the output

Line to echo
run_echo: line 2: $'\r': command not found
Another line

I also tested it on my portable. There I do not have the problem. The main
difference between the two systems is that the OS in the first case is
2003 Server and in the second case Windows XP.

Regards,

Jurgen

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list