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] |
On 04/26/2012 08:13 AM, Andrew DeFaria wrote: > I remember that Cygwin used to not be able to run scripts that were > converted or were in "DOS" mode - had trailing carriage returns in the > file. It would fail because the #! line might have /bin/bash\r which was > not a file (bash with a carriage return that is). But the behavior has > changed. Now it seems to ignore the trailing carriage return and it > execs bash itself. But it fails later on with other carriage returns. If you want bash to ignore carriage returns, then ask it to do so: http://sourceware.org/ml/cygwin-announce/2011-02/msg00027.html > 4. This version of bash has a cygwin-specific set option, named "igncr", > to force bash to ignore \r, independently of cygwin's mount style. As > of bash-3.2.3-5, it controls regular scripts, command substitution, and > sourced files. I hope to convince the upstream bash maintainer to > accept this patch into a future bash release even on Linux, rather than > keeping it a cygwin-specific patch, but only time will tell. There are > several ways to activate this option: > 4a. For a single affected script, add this line just after the she-bang: > (set -o igncr) 2>/dev/null && set -o igncr; # comment is needed > 4b. For a single script, invoke bash explicitly with the option, as in > 'bash -o igncr ./myscript' rather than the simpler './myscript'. > 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. > 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'. If exported, then all bash child > processes inherit the same option settings; with the exception added in > 3.2.9-11 that certain interactive options are not inherited in > non-interactive use. > 4e. bash-4.1.9-1 dropped support for 'shopt -s igncr'; it did not make > sense to support the option through both set and shopt, and SHELLOPTS > proved to be more powerful. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |