[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected behavior of grep-use-null-device in non-interactive mode
From: |
Eli Zaretskii |
Subject: |
Re: Unexpected behavior of grep-use-null-device in non-interactive mode |
Date: |
Tue, 23 Feb 2021 19:24:16 +0200 |
> From: <david.chappaz@free.fr>
> Date: Mon, 22 Feb 2021 15:00:24 -0800
>
> Why is /dev/null added to the command at step 3 ?
>
> Is this a bug ? Or perhaps my expectations are not quite right ?
The function that auto-detects null-device support is only called when
you invoke the command interactively. And the doc string actually
says so:
(defcustom grep-use-null-device 'auto-detect
"If t, append the value of `null-device' to `grep' commands.
This is done to ensure that the output of grep includes the filename of
any match in the case where only a single file is searched, and is not
necessary if the grep program used supports the `-H' option.
In interactive usage, the actual value of this variable is set up
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
by `grep-compute-defaults'
^^^^^^^^^^^^^^^^^^^^^^^^^
Why do you need to call 'grep' noninteractively, and still want it to
show the hits as if it were an interactive call?