[16626] in Athena Bugs
sun4 8.2.15: emacs
daemon@ATHENA.MIT.EDU (Laura Baldwin)
Wed Jan 20 17:49:05 1999
To: bugs@MIT.EDU
Date: Wed, 20 Jan 1999 17:49:02 EST
From: Laura Baldwin <boojum@MIT.EDU>
System name: geskekelud.mit.edu
Type and version: SPARC/5 8.2.15 (with mkserv)
Display type: cgsix
What were you trying to do?
use the find-grep-dired command
What's wrong:
The grep command uses -q, which our grep doesn't support
What should have happened:
it should have used -s, or used ggrep -q
Please describe any relevant documentation references:
The syntax find-grep-dired uses is
find . \( ! -type d -exec grep -q string {} \; \) -exec ls -ld {} \;
which produces the error (many times) of
grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
From find-dired.el in /usr/athena/share/emacs/19.34/lisp/:
(defvar find-grep-options (if (eq system-type 'berkeley-unix) "-s" "-q")
"*Option to grep to be as silent as possible.
On Berkeley systems, this is `-s'; on Posix, and with GNU grep, `-q' does it.
On other systems, the closest you can come is to use `-l'.")
system-type is usg-unix-v, so it's using -q, but the default athena
grep isn't GNU grep, it's, um, I don't know actually what it is.
Anyway, grep -s would work, and ggrep -q would also work.
Anyway, I have a personal workaround in my .emacs of
(defun find-grep-dired (dir args)
"Find files in DIR containing a regexp ARG and start Dired on output.
The command run (after changing into DIR) is
find . -exec grep -s ARG {} \\\; -ls
Thus ARG can also contain additional grep options."
(interactive "DFind-grep (directory): \nsFind-grep (grep regexp): ")
;; find -exec doesn't allow shell i/o redirections in the command,
;; or we could use `grep -l >/dev/null'
(find-dired dir
(concat "! -type d -exec ggrep " find-grep-options " "
args " {} \\\; ")))
(I replaced grep with ggrep, that's the only difference), but that
wouldn't be a good universal fix for people who don't have gnu added.
-Laura