bash: igncr shell option breaks my PS1 prompt

Gene Pavlovsky
Fri Sep 2 11:52:00 GMT 2016

Dear Eric Blake,

I understand there were issues with read handling of \r. But is the
resulting solution/bugfix ideal? Or does it introduce new problems?

Basically, I don't want to set `igncr` as system-wide shell option
(e.g. through SHELLOPTS). I want to require scripts to use LF newlines
- if there's a script somewhere with CRLF newlines, I want it to break
immediately (which it would do by default, when igncr is disabled).
Then I will notice and convert it's newlines (dos2unix) right away.
So, how do I keep an existing bash script, that uses `read` piped from
the output of a Windows console program that uses CRLF as newlines,
working, without modifying the script? I don't see how it's possible
with the current situation.

Personally I think that by default read should behave as it did for
years. Backwards compatibility 101... Add a new shell option (separate
from igncr) if you'd like, but keep the default behavior same as it
was for a long time. How do you think?

Regards, Gene Pavlovsky

On 30 August 2016 at 16:40, Eric Blake <> wrote:
> On 08/30/2016 02:49 AM, Houder wrote:
>> ... uhm ... what about the explanation in the help?
>>       -o option-name
>>           Set the variable corresponding to option-name:
>>               ...
>>               igncr        on cygwin, ignore \r in line endings
>>                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> ... this help message should be 'upgraded', should it not?
> Sure, I'll tweak that text, once I can find what about igncr is making
> PS1 misbehave on \n.  But help would be welcome, if anyone else is also
> interested in looking into the cygwin-specific patches and actually
> reviewing them.
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list