From mboxrd@z Thu Jan 1 00:00:00 1970 From: Weiqi Gao To: gnu-win32@cygnus.com Subject: Re: CONTINUING Elementary Problems with Find Date: Wed, 22 Oct 1997 22:14:00 -0000 Message-id: <344EDD14.1A1266EA@a.crl.com> References: <00084699.3272@fhssmtp.redstone.army.mil> X-SW-Source: 1997-10/msg00501.html 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".