Subject: Re: `find' command broken.
From: [email-masked] ("$Bill Luebkert")

12 Jul 1997 09:31:17 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <19970711092719531.AAA303@TENDLE>
				<[email-masked]> <19970711133409718.AAA335@TENDLE> <[email-masked]> <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
Original-To: Gilligan <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

Gilligan wrote:
> 
> $Bill Luebkert wrote:
> >
> > John Cooper wrote:
> > command.com works (does a globbed find) if I leave the quotes off,
> > tcsh and bash work if I put the quotes on, which is what you would
> > expect, except for the gotcha.  It only works if there
> > are no files matching the glob in the current dir (the one you're
> > sitting in, not the effective starting dir).  Strange problem!
> 
> Globbing works that way, and has for years in the Unix world.  If you
> do: ls -l *.c, the appropriate shell (or is it cygwin.dll?), does the
> search for any .c files from the current directory, and pastes them into
> the arguments for the program.  So ls (or find, or whatever program)
> would only see "ls -l a.c b.c" in it's argv[] array.  When you then look
> at the find above, done with globbing and the two .c files, the find
> command sees "find . -name a.c b.c -print"

Not when you have the single quotes around '*.c'.  That escapes the 
arg from globbing.

> > It acts like find is globbing the name against the current dir prior
> > to picking up the args or executing the command.  If I knew
> > where the source for find was, I would take a look at it.
> 
> That's the way Unix has been, and will always be.  On the other hand,
> some shells allow you to set a variable to disable globbing.  I'm not
> sure if cygwin.dll pays any attention to it.  I think it is "set
> noglob," read the man page of bash to see if it has a similar setting.

When you escape the arg with single quotes, the arg is passed to the 
command intact, no globbing is to be performed.  Since it works from 
a dir that doesn't have any .c files in it, I have to assume that 
the arg is passed to the task as *.c not a.b b.c otherwise the dirs
further down in the tree would fail and not print out the .c files 
found there.

No, this appears to be a problem in find IMHO, or at least not the 
shell.  But time will tell.  Anyone know where the source is?

-- 
  ,-/-  __      _  _         $Bill Luebkert
 (_/   /  )    // //       DBE Collectibles
  / ) /--<  o // //      http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_    Email: [email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".