[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error when script uses CRLF line endings w/ if stmt

From: Eric Blake
Subject: Re: Error when script uses CRLF line endings w/ if stmt
Date: Fri, 05 Feb 2010 06:25:21 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090812 Thunderbird/ Mnenhy/

According to Jan Schampera on 2/4/2010 10:39 PM:
> address@hidden schrieb:
>>      Some of the time, using CRLF line endings cause syntax errors
>>      in Bash scripts ("unexpected end of file").
>>      This problem shows up on Bash 4.1 on Linux, Bash 3.2 on Linux,
>>      and Bash 3.2 on Cygwin (where I first noticed it).
> Normal. Though I don't know how to treat the Cygwin case, since the
> underlying platform uses \r\n anyways.

Cygwin specifically recommends AGAINST using \r\n.  The goal of cygwin is
to be a Linux emulation, and Linux does not use \r, so cygwin bash will
treat \r in the same manner as Linux _unless_ you turn on the
cygwin-specific 'shopt -r igncr' option which I wrote as part of
maintaining bash for cygwin.  That option is your contract stating that
_you_ are aware your script is non-portable, and therefore you are no
longer bound by the standards and cygwin bash can then ignore \r on your

It might be nice if upstream bash accepted a patch to make igncr available
to all platforms, not just cygwin.  Is there any interest?  If so, I can
port my cygwin-specific bash patches and post them on this list.  If not,
then those patches will remain cygwin-specific.

Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]