bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep -r problem


From: Eli Zaretskii
Subject: Re: grep -r problem
Date: Sat, 10 May 2003 21:07:11 +0300

> Date: Sat, 10 May 2003 10:56:09 -0600
> From: address@hidden (Bob Proulx)
> 
> Eli Zaretskii wrote:
> > > Russ Koyle writes:
> > >  grep -l -r void *.c
> > > grep: *.c: No such file or directory
> > 
> > That's because you misunderstand the meaning of -r.  It does _not_
> > search *.c files in all subdirectories; instead, it recursively
> > searches in all subdirectories whose names match *.c.
> 
> Yes.  But I think your explaination has a dangling modifier which
> makes it ambigous still.

It was ambigous on purpose: I wanted to encourage the OP to re-read
the docs.  Now you have ruined my carefully crafted plan ;-)

> The shell expands *.c before the command ever sees it.  Use 'echo' to
> look at what is getting executed.  In the case that there is no match
> then the literal * will get passed through.

You are assuming too much here, IMHO.  First, you assume that we are
dealing with a Unix shell.  While the OP did say it's on HP/UX, he
might well be running Grep on Windows tomorrow, where stock shells
don't expand wildcards (instead, the startup code of Grep does that).

And second, where *.c doesn't match anything, some Unix shells will
say "No match" and refuse to invoke Grep at all (apparently, the shell
used by the OP is not of this variety).




reply via email to

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