Find misses a match to glob pattern unless the pattern is made more specific

4

I was using find to search for a file on my machine like so:

find / -name version-1.0.*

and the result was just one file in my home directory, version-1.0.23. However, if I ran the following:

find / -name version-1.0.1*

the result was /data/somelongpath/version-1.0.19.

Why would this second result be omitted from the results in the first case?

jonderry

Posted 2011-06-16T23:04:13.893

Reputation: 837

Answers

10

You have a file that matches the glob in the current directory, and your shell is globbing it. Escape the glob.

find / -name 'version-1.0.*'

Ignacio Vazquez-Abrams

Posted 2011-06-16T23:04:13.893

Reputation: 100 516

Extra info for readers: "globbing" refers to the shell expanding wildcards into the full filename or a list of filenames. The shell does this before executing the program. – Zan Lynx – 2011-07-29T22:30:42.943