Updated: bash-3.1-9

Eric Blake ebb9@byu.net
Tue Oct 3 04:13:00 GMT 2006

Hash: SHA1

A new release of bash, 3.1-9, is now available, replacing 3.1-8 as the
current version.  3.1-6 remains as the previous version.

Due to complaints on the mailing list, this version attempts to alleviate
some of the pain of people who have difficulties working around \r\n line
endings in scripts residing on binary mounts.  First, if a script is
specified with a DOS path instead of a POSIX path (although this is not
the recommended behavior in cygwin), bash will ensure that the underlying
mount mode is respected, rather than the default cygwin behavior of using
binary mode, allowing the use of DOS paths on text mounts the way 3.1-6
behaved.  Second, this release adds a new shopt, igncr, which dynamically
tells bash to ignore all \r in the input file when it is set; however, it
defaults to unset.  With this shopt, it is possible to make a bash script
work on binary mounts even if it has \r\n line endings, by adding the
following line as the first non-comment:
  shopt -s igncr;#
The comment is necessary since bash parses a line at a time before
processing shopt, so you want to avoid interpreting the last potential \r
literally before the change takes place.  If you want your script to be
portable to other platforms or shells that don't understand igncr, you can
write it as:
  (shopt -s igncr) 2>/dev/null && eval 'shopt -s igncr';#
For now, the igncr shopt is only documented in this mail; I thought it
better to get 3.1-9 out the door than to spend time also patching the
online documentation and delaying the release.  It is also a chance for
any feedback to the list to influence whether I need to make 3.1-10 in the
near future.

Meanwhile, if you use binary mounts (recommended), bash will treat \r
literally unless you use the new shopt, because of the speed increase
possible by parsing files literally instead of one character at a time.
The d2u tool can convert scripts to avoid \r\n line endings.  If you use
text mounts, \r is silently ignored, with no need to worry about using the
igncr shopt.  It is probably better to limit text mounts to just the
directories with problematic shell scripts, rather than trying to make
your entire cygwin installation textmode, as not all cygwin tools behave
gracefully on text mounts.  Also, it is marginally faster to use the shopt
on a binary mount than it is to use a text mount, although neither
workaround is as fast as just converting your script to use plain \n line

Remember, you must not have any bash or /bin/sh instances running when you
upgrade the bash package.  This release will work with cygwin-1.5.21-1 or

Bash is an sh-compatible shell that incorporates useful features from the
Korn shell (ksh) and C shell (csh).  It is intended to conform to the IEEE
POSIX P1003.2/ISO 9945.2 Shell and Tools standard.  It offers functional
improvements over sh for both programming and interactive use. In
addition, most sh scripts can be run by Bash without modification.

As of the bash 3.0 series, cygwin /bin/sh defaults to bash, not ash,
similar to Linux distributions.

To update your installation, click on the "Install Cygwin now" link on the
http://cygwin.com/ web page.  This downloads setup.exe to your system.
Save it and run setup, answer the questions and pick up 'bash' in the
'Base' category (it should already be selected).

Note that downloads from sources.redhat.com (aka cygwin.com) aren't
allowed due to bandwidth limitations.  This means that you will need to
find a mirror which has this update, please choose the one nearest to you:

If you want to make a point or ask a question the Cygwin mailing list is
the appropriate place.

- --
Eric Blake
volunteer cygwin bash maintainer

To unsubscribe to the cygwin-announce mailing list, look at the
"List-Unsubscribe: " tag in the email header of this message.  Send email
to the address specified there.  It will be in the format:


If you need more information on unsubscribing, start reading here:


Please read *all* of the information on unsubscribing that is available
starting at this URL.

Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Cygwin-announce mailing list