This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

Re: find Exhibits Strange Behavior ?


Paul,

Always quote the pattern arguments so they're not expanded by the shell before being passed on to "find."

This is just as it is on any ixoid platform.

Shells have options about what to do with glob expressions when no matches are present. In BASH it's the "nullglob" option. Not knowing how you have it set nor what files exist in the directories where you tried the various invocations, it's hard to give a definitive explanation for what you're experiencing.

Example:

% shopt -s nullglob
% echo *.glarch

% shopt -u nullglob
% echo *.glarch
*.glarch


Randall Schulz


At 15:20 2003-01-18, Paul T. Karch wrote:
After I startup with cygwin.bat I am put
into the /home/user directory.
If I try to do any of the commands:
find . -iname *.c
find  -iname *.c
find / -iname *.c

I get the following:

find: paths must precede expression
Usage: find [path...] [expression]

If I enter:
find *.c
it works OK, but not recursively
(as I found out in a 2nd pass on the test).

I made a subdirectory of  "user"; copied some files;
 and cd'ed to it and entered:

find  . -iname *.c

it works fine.

If  I cd to / and enter
 find . -iname *.c
it displays some results, but if I
cd to usr and issue the same command
I get more results than I got in the "higher"
/ directory.  But doesn't this  mean that
find is not working recursively as it should ?

However under "/" I changed the command to
find / -iname '*.c'
and it worked as I expected.  Thus emboldened,
I cd'ed to ~ and tried   find . -iname '*.c'     and
it worked fine.

This is not really a problem, I guess, but it is curious.
Also I may not be interpreting the meaning of the find command
properly.  Any comments ?

Paul T. Karch

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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