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: CONTINUING Elementary Problems with Find


GBradfor wrote:
> 
> Thanks to all who responded to my first post.  Yes, indeed, it was the
> Windows version of find that was causing my problem.  However,
> correcting this problem has revealed another.  Again, it is probably
> newbie in nature, but your assistance is appreciated.
> 
> Taking my initial command line:
>   find . -name *.c -print
> 
> gives the following error:
>   find:  Paths must precede expression
>   Usage:  find [path...] [expression]

Watch out for the shell, because the shell has the first stab at the
command line.  If you are using the Windows 95 COMMAND.COM shell, then
*.c gets expanded to:
  i) a list of your .c files in the current directory; --OR--
  ii) if there are no .c files in the current directory, *.c

As a consequence, find will see different things depending on how many
.c files you have in the directory.  The command line that find will see
will be:
  i) find . -name a.c -print (if a.c is the only .c file in the current
directory)
  ii) find . -name a.c b.c -print (if a.c and b.c are the .c files in
the current directory)
  iii) find . -name *.c -print (if there are no .c files in the current
directory)
  iv) a command line similar to ii) when more than two .c files exist in
the current directory

You will get the result that you expecte in cases i) and iii).  You will
get the error message that you cited in cases ii) and iv).

> Just to check things out, I got into bash and checked my pwd
> (/gnu_src/cdk/winsup), and I entered this absolute address into the
> command line.  No luck, same error.

When in find, parse as the shells do.

--
Weiqi Gao
weiqigao@a.crl.com
-
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]