I'm using GNU Emacs 26.3 on a Windows 10 system (Virtualbox guest on Mac).
The following grep command inside emacs fails:
grep -i -n -d skip -e temp_ *
with this error:
grep -i -n -d skip -e temp_ * NUL
agrep: NUL: No such file or directory
Grep exited abnormally with code 2 at Mon Mar 23 12:27:03
If I run the command in the wsl
shell it works.
The following grep command inside emacs also works fine:
grep -i -n -d skip -e temp *
Note: the missing _ at the end.
I tried escaping the underscore with \
and \\
, nothing helped.
Any ideas? Thanks a lot.
Edit: FYI: I'm using the following shell command, which works fine for other grep, make, etc. commands:
(setq explicit-shell-file-name "C:/Windows/System32/bash.exe")
(setq shell-file-name explicit-shell-file-name)
as for Tobias request: I run the 'grep command via my shortcut F5:
(global-set-key [f5] 'grep)
then:
Run grep (like this): grep -i -n -d skip -e temp_ *
emacs -Q
. – Tobias Mar 23 '20 at 12:15explicit-shell-file-name
has nothing to do withgrep
. What is the value ofshell-file-name
that is really used? – Tobias Mar 23 '20 at 17:02explicit-shell-file-name
andshell-file-name
restart Emacs and try again. I assume that/bin/sh
is used in that case. If you want bash syntax you could setexplicit-shell-file-name
to/bin/bash
. – Tobias Mar 24 '20 at 7:51