[K12OSN] find command

Chuck Kollars ckollars9 at yahoo.com
Thu Aug 30 05:08:53 UTC 2007


> ... if you were in a directory with the contents: 
> blah one two and you did a find like this: 
>  find . -name *.txt 
> It would have looked for the three files blah.txt 
> one.txt and two.txt ...
> Now, with the version of redhat I have (AS4), doing 
>  find . -name *.txt 
> looks through and finds the appropriate *.txt file
>  like you would expect.

I'd strongly recommend NOT relying on the new RedHat
behavior. The expansion of '*' is a function of the
shell, not of any particular command (including
`find`). RedHat somehow kludged the `find` command to
work differently. But the (unintuitive in this
particular situation) expansion of '*' has been that
way for ages and ages in all kinds of versions and
distros and across all shells, and any script you
write that depends on the new RedHat kludge is almost
certain to not be portable. 

The complaint that the `find` syntax is awkward and
hard to use has been around for at least 25 years.
Using an entirely different command is probably a good
choice.

I --being one of the diehards that still use `find`
heavily-- ALWAYS put quotes around the arguments to
`find`. It's such a strong habit my fingers do it all
by themselves. I ALWAYS write things like


-Chuck Kollars


       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433




More information about the K12OSN mailing list