This is the mail archive of the cygwin 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: Behaviour of 'find' under 'bash'


On Wed, 12 May 2004, Song Ken Vern-E11804 wrote:

> Hi, 
> 
> The find command seems to be behaving differently depending on the content of the current directory. 

Isn't that sort of a design requirement for a search tool? ;)

> drwxr-xr-x+   4 Administ ????????     4096 May 12 08:41 ./
> drwxr-xr-x+  12 Administ ????????     8192 May  6 17:02 ../
> drwxr-xr-x+   2 Administ ????????     8192 May 11 14:06 Code/
> drwxr-xr-x+   4 Administ ????????        0 Mar 24 10:22 XML/
> -rwxr-xr-x+   1 Administ ????????    55022 Apr 20 11:00 XMLParser-rik.java*
> -rw-------    1 E11804   mkgroup-    28367 May 12 08:41 cygcheck.out
> 
> When I issue a : - 
> 
> 08:43$ find ./ -name *.java

You do know that your shell expands the *.java expression before
feeding the resulting command line to the find command?

So you are essentially invoking find like this:

    find . -name XMLParser-rik.java

you are telling find to locate all files which have that exact name.

> 
> But when I issue a :- 
> 
> 08:43$ find ./ -name \*.java

Now you are escaping the wildcard so the shell does not process it. The
find command now receives the pattern and interprets it in the context
of its search.

> It seems like the the shell is substituting '*' with the filename in the current directory. 

You are close. The shell is doing something, indeed. ;)


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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]