This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: `find' command broken.


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: dbe@wgn.net
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]