According to Jan Schampera on 2/4/2010 10:39 PM: > drisc...@cs.wisc.edu 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 behalf. 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 e...@byu.net
signature.asc
Description: OpenPGP digital signature