[lug] Puzzle with find

Jeff Schroeder jeff at neobox.net
Thu Jul 7 15:01:45 MDT 2005


Gordon said:

> I want to find any file whose name contains "install"
> I do:  find / -name *install*
>
> This works just fine.  Except if I am in the root directory:

I suspect your shell is expanding *install* because there's some 
directory or file in /root that matches.

The better approach would be to "protect" your wildcards from shell 
expansion, thus:

/usr/bin/find / -name "*install*"

(Note the double-quotes around the pattern you're matching.)

HTH,
Jeff



More information about the LUG mailing list