delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/22/22:59:43

From: weiqigao AT a DOT crl DOT com (Weiqi Gao)
Subject: Re: CONTINUING Elementary Problems with Find
22 Oct 1997 22:59:43 -0700 :
Message-ID: <344EDD14.1A1266EA.cygnus.gnu-win32@a.crl.com>
References: <00084699 DOT 3272 AT fhssmtp DOT redstone DOT army DOT mil>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019