bug-bash
[Top][All Lists]
Advanced

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

Re: Bash with Dos File problem


From: Eric Blake
Subject: Re: Bash with Dos File problem
Date: Sun, 23 Sep 2007 21:35:20 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Larry Johnson on 9/23/2007 3:39 AM:
> Hello,
> 
> I am running GNU Bash 3.2.9(11) on a PC with Vista and using Cygwin.

Bash behavior on line endings when using cygwin is probably better
discussed on the cygwin list, cygwin AT cygwin DOT com.

> I discovered the problem was that the script file was in Dos format with the 
> LF and CR at the end of the line.

The cygwin port of bash currently has a patch that adds a shell option
'igncr', similar to the tty option of the same name.  I can repost that
patch here if there is interest in including the patch upstream, for the
case of a network mount where the files might include dos line endings.
Normally, bash treats \r as a literal character, and causes problems, as
you discovered; but with my igncr patch enabled, bash skips those bytes.

> I use lots of Bash scripts in Dos format with no problems.

It may be that you were using those scripts from a cygwin text mount,
where cygwin already removed the \r.  But on a cygwin binary mount, or on
most Unix-y machines, you do not have that luxury.

> Is there a newer version of Bash that does not have this problem?

No.  The problem is in your scripts vs. your mount options, and not in
bash.  If you intend to use \r in your scripts on cygwin, then you should
either use a text mount or use the igncr option.  Or put another way, if
you intend to use binary mounts on cygwin, then don't put spurious \r in
your files.  That said, however, you may want to upgrade, since cygwin now
ships with bash 3.2.25.

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

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG9zB484KuGfSFAYARArnFAKC+b1oatYwovSoe9QSckKeM4LOe3QCbBTBA
fJWDTQYPoTW8VljXc9UCevE=
=gu4W
-----END PGP SIGNATURE-----




reply via email to

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