[K12OSN] find command

Chuck Kollars ckollars9 at yahoo.com
Thu Aug 30 05:21:26 UTC 2007

My apologies for the incomplete post (this interface
interprets some keystrokes in a way I'm not used to).
Here's what I intended to send:

> ... 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 despite what the shell tries to do.
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
and/or not work right in the future and/or not be
Posix compatible. 

The complaint that the `find` syntax is very awkward
and hard to use (even for *nix) has been around for a
long time -- it was common lore that I picked up in
the early '80s. 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 type things like 
   find . -name "*.txt" 
Besides always working as expected, this will also
work with the RedHat "enhancement" without wrecking


-Chuck Kollars

Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.

More information about the K12OSN mailing list