Preparing a new machine for development, I upgraded Cygwin and the CVS client as described in the subject line: from (Cygwin 1.5.5-1 + CVS 1.11.21) to (cygwin-1.7.5 + CVS 1.11.22)

All went well, but a 1-line convenience bash script I have been carrying around for years stopped working. It used to filter out all uninteresting lines from 'cvs status':

cvs status | grep -F File | grep -v Up-to-date

In the new version, it seemed as if "grep -v" simply stopped working (i.e. wasn't filtering OUT anything). So I tried:

cvs status 2>&1 | grep -F File | grep -v Up-to-date

But that didn't change the behavior. The output was still as if "grep -v" were never called. So, I tried:

cvs status 2>&1 | grep -F File 2>&1 | grep -v Up-to-date

And that solved the problem! The script now behaves identically in (Cygwin 1.5.5-1 + CVS 1.11.21) and (cygwin-1.7.5 + CVS 1.11.22).

My question now is why?

What happened to Cygwin's grep that it now requires redirection from stderr to stdout?

Please note that I intentionally emphasized the word script, because the original command (the first one quoted above) still works identically in both old and new environments, if typed from the command line (i.e. not inside a #!/bin/bash script).

Any idea why this is?

  • 1
    Not helpful enough to be an answer, but I've always found andlinux.org to be much more user-friendly than Cygwin.
    – user31752
    Sep 2, 2010 at 3:32
  • Interesting. Never heard of andlinux before. Thanks for introducing andlinux.org to me. +1 for that. Sep 2, 2010 at 5:00

2 Answers 2


I don't know for sure in this case, but a common cause of scripts failing to work with newer versions of Cygwin's bash is DOS (CR-LF) line endings. Perhaps your last change to that script also changed the line ending. Make sure your scripts use only Unix (LF) line endings. Otherwise, grep will see its pattern argument as "Up-to-date^M".

  • +1 for attempting to decipher this mystery. No, the problem doesn't lie in the CRLF vs. LF ending. As I have both versions of the script with the same exact line ending (I use Emacs in hexl-mode to see exactly what's in it). I suspect the problem has to do with forking and/or inheriting the environment. Something has changed and I suspect it's in Cygwin, not in CVS. Sep 2, 2010 at 2:08

It's time to accept an answer. The only reasonable explanation so far is that something has changed in they way Cygwin's grep splits output to stderr and stdout. If a better or more authoritative answer comes along, I will consider accepting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.