bug-grep
[Top][All Lists]
Advanced

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

Re: grep-dir test


From: Paolo Bonzini
Subject: Re: grep-dir test
Date: Tue, 20 Dec 2011 15:58:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 12/20/2011 06:20 AM, Eli Zaretskii wrote:
>  The intent of the test is that grep should behave differently when
>  operating on a directory instead of a regular file.
Can you elaborate on that difference in behavior?  I mean the
difference between

   echo foo | grep -f empty-directory/

This should be a hard failure. Asking grep to open a directory and search for patterns in it is wrong.

and

   echo foo | grep -f empty-file

This should search for "no pattern", and hence print nothing but still consume the input.

So, these should print nothing:

    echo foo | grep -f /dev/null
    echo foo | (grep -f /dev/null; cat)

This should print an error message:

    echo foo | grep -f /

This should print an error message followed by "foo":

    echo foo | (grep -f /; cat)

If you get XPASSes from the last two on Windows, that's good. :) It's working better than POSIX. :)

Paolo



reply via email to

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