[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find 4.2.20 "-name" option
From: |
James Youngman |
Subject: |
Re: find 4.2.20 "-name" option |
Date: |
Wed, 4 May 2005 09:04:35 +0100 |
User-agent: |
Mutt/1.3.28i |
On Mon, May 02, 2005 at 10:54:01PM -0600, Bob Proulx wrote:
> Darrell Tangman wrote:
> > I just installed findutils 4.2.20 and am finding that existing scripts
> > need tweaking. The latest problem (and the only thing that appears to be
> > an actual bug, and not just an incompatibility) is that the command
> >
> > find . -name '*' -print
> >
> > begins its output with ".", followed by "./somename", where "somename" is
> > the first name found in the current directory.
> > According to the documentation, "*" does not match "." at the
> > beginning of the basename; it appears that find is now treating the
> > basename of "." as an empty string, which is a very curious
> > behavior.
That sounds like a documentation bug, but I can't find it. My local
copy here says :-
Info documentation:
|| @deffn Test -name pattern
|| @deffnx Test -iname pattern
|| True if the base of the file name (the path with the leading directories
|| removed) matches shell pattern @var{pattern}. For @samp{-iname}, the
|| match is case-insensitive. To ignore a whole directory tree, use
|| @samp{-prune} (@pxref{Directories}). As an example, to find Texinfo
|| source files in @file{/usr/local/doc}:
||
|| @example
|| find /usr/local/doc -name '*.texi'
|| @end example
|| @end deffn
||
|| Patterns for @samp{-name} and @samp{-iname} will match a filename with
|| a leading @samp{.}. For example the command @samp{find /tmp -name
|| \*bar} will match the file @file{/tmp/.foobar}.
Manual page:
|| .IP "\-iname \fIpattern\fR"
|| Like \-name, but the match is case insensitive. For example, the
|| patterns `fo*' and `F??' match the file names `Foo', `FOO', `foo',
|| `fOo', etc. In these patterns, unlike filename expansion by the
|| shell, an initial '.' can be matched by '*'. That is,
|| .B find \-name *bar
|| will match the file `.foobar'.
> I look at the POSIX docs which say:
>
> The leading period shall not be matched by:
> * The asterisk or question-mark special characters
>
> So that does seem to support your statement.
Ostensibly, yes, but a PASC interpretation has clarified this to
indicate that that discussion refers only to wildcard expansion by the
shell. See
http://standards.ieee.org/reading/ieee/interp/1003-2-92_int/pasc-1003.2-126.html.
Findutils 4.2.1 made this change - see the NEWS file.
Regards,
James Youngman.