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.


James Dumser writes:
 > >    H:\ef>find . -name *.c -print
 > >    find: paths must precede expression
 > >    Usage: find [path...] [expression]
 > >    H:\ef>
 > 
 > And the fact that cmd does not glob is the "problem": bash globs; but 
 > since cmd doesn't, cygwin32 globs for it (because Unix programs expect 
 > globbing to be done). 

Well, if cygwin32 globs, why doesn't it work under cmd.exe?

    H:\ef>dir
     Directory of H:\ef
    11/07/97  09:48                      0 a.c
    11/07/97  09:48                      0 b.c
		   4 File(s)              0 bytes
				589,430,784 bytes free

    H:\ef>find . -name *.c -print
    find: paths must precede expression
    Usage: find [path...] [expression]

    H:\ef>find . -name '*.c' -print

    H:\ef>

 > This will work under bash IFF there are no .c files in the current 
 > directory (bash tries to glob; but since there are no matches, it leaves
 > it alone) -- in which case, running under cmd should have the same 
 > results). Did you run your tests (cmd vs bash) from the same directory?

Right.  I realize bash globs, but *so does zsh*, and yet `find' doesn't work
under zsh.

Could it be that cygwin.dll is somehow doing the globbing for zsh (even when
the *.c is in quotes)?

Here's the failure under zsh:

    zsh$ find . -name '*.c' -print                                            H:/
    /c/gnuwin32/b18/h-i386-cygwin32/bin/find.EXE: paths must precede expression
    Usage: /c/gnuwin32/b18/h-i386-cygwin32/bin/find.EXE [path...] [expression]
    zsh$ ls *.c                                                               H:/
    a.c  b.c
    zsh$                                                                      H:/

Here, (oddly) it works under bash:

    bash$ find . -name '*.c' -print
    ./a.c
    ./b.c

The following shows that both zsh and bash pass exactly the same string to
the `find' command:

zsh$ echo find . -name '*.c' -print
find . -name *.c -print
zsh$

bash$ echo find . -name '*.c' -print
find . -name *.c -print
bash$


I can only guess that the find command (cygwin32.dll) *knows* that it's been
invoked by bash and then doesn't try to do the glob?  Under zsh, the extra
glob appears to be done by find (cygwin32.dll?)

Thanks,

    --- John

-
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]