Print this page
3768 fnmatch(5) is worded poorly

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man5/fnmatch.5
          +++ new/usr/src/man/man5/fnmatch.5
↓ open down ↓ 1 lines elided ↑ open up ↑
   2    2  .\"  Copyright (c) 1992, X/Open Company Limited
   3    3  .\"  All Rights Reserved  Portions Copyright (c) 1995, Sun Microsystems, Inc.
   4    4  .\"  All Rights Reserved
   5    5  .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6    6  .\" http://www.opengroup.org/bookstore/.
   7    7  .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8    8  .\"  This notice shall appear on any product containing this material.
   9    9  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10   10  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11   11  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12      -.TH FNMATCH 5 "Mar 28, 1995"
       12 +.TH FNMATCH 5 "Jun 14, 2015"
  13   13  .SH NAME
  14   14  fnmatch \- file name pattern matching
  15   15  .SH DESCRIPTION
  16      -.sp
  17   16  .LP
  18   17  The pattern matching notation described below  is used to specify patterns for
  19   18  matching strings in the shell. Historically, pattern matching notation is
  20   19  related to, but slightly different from, the regular expression notation. For
  21   20  this reason, the description of the rules for this pattern matching notation is
  22   21  based on the description of regular expression notation described on the
  23   22  \fBregex\fR(5) manual page.
  24   23  .SS "Patterns Matching a Single Character"
  25      -.sp
  26   24  .LP
  27      -The following \fIpatterns matching a single character\fR match a single
  28      -character: \fIordinary characters\fR, \fIspecial pattern characters\fR and
  29      -\fIpattern bracket expressions\fR. The pattern bracket expression will also
  30      -match a single collating element.
       25 +The following patterns match a single character: \fIordinary characters\fR,
       26 +\fIspecial pattern characters\fR and \fIpattern bracket expressions\fR. The pattern
       27 +bracket expression will also match a single collating element.
  31   28  .sp
  32   29  .LP
  33   30  An ordinary character is a pattern that matches itself. It can be any character
  34   31  in the supported character set except for \fINUL\fR, those special shell
  35   32  characters that require quoting, and the following three special pattern
  36   33  characters. Matching is based on the bit pattern used for encoding the
  37   34  character, not on the graphic representation of the character. If any character
  38   35  (ordinary, shell special, or pattern special) is quoted, that pattern will
  39   36  match the character itself. The shell special characters always require
  40   37  quoting.
↓ open down ↓ 114 lines elided ↑ open up ↑
 155  152  to extract a filename ending with \fBa(?\fR.
 156  153  .RE
 157  154  .sp
 158  155  .LP
 159  156  Conforming applications are required to quote or escape the shell special
 160  157  characters (sometimes called metacharacters). If used without this protection,
 161  158  syntax errors can result or implementation extensions can be triggered. For
 162  159  example, the KornShell supports a series of extensions based on parentheses in
 163  160  patterns; see  \fBksh\fR(1)
 164  161  .SS "Patterns Matching Multiple Characters"
 165      -.sp
 166  162  .LP
 167  163  The following rules are used to construct \fIpatterns matching multiple
 168  164  characters\fR from \fIpatterns matching a single character\fR:
 169  165  .RS +4
 170  166  .TP
 171  167  .ie t \(bu
 172  168  .el o
 173  169  The asterisk (*) is a pattern that will match any string, including the null
 174  170  string.
 175  171  .RE
↓ open down ↓ 55 lines elided ↑ open up ↑
 231  227  .ne 2
 232  228  .na
 233  229  \fB\fB*a*d\fR \fR
 234  230  .ad
 235  231  .RS 10n
 236  232  matches the strings \fBad\fR, \fBabcd\fR, \fBefabcd\fR, \fBaaaad\fR and
 237  233  \fBadddd\fR.
 238  234  .RE
 239  235  
 240  236  .SS "Patterns Used for Filename Expansion"
 241      -.sp
 242  237  .LP
 243  238  The rules described so far in \fBPatterns\fR \fBMatching\fR \fBMultiple\fR
 244  239  \fBCharacters\fR and \fBPatterns\fR \fBMatching\fR \fBa\fR \fBSingle\fR
 245  240  \fBCharacter\fR are qualified by the following rules that apply when pattern
 246  241  matching notation is used for filename expansion.
 247  242  .RS +4
 248  243  .TP
 249  244  1.
 250  245  The slash character in a pathname must be explicitly matched by using one
 251  246  or more slashes in the pattern; it cannot be matched by the asterisk or
↓ open down ↓ 46 lines elided ↑ open up ↑
 298  293  read permissions are needed for directory \fBbar\fR, and search permission is
 299  294  needed for each \fBx*\fR directory.
 300  295  .sp
 301  296  If the pattern matches any existing filenames or pathnames, the pattern will be
 302  297  replaced with those filenames and pathnames, sorted according to the collating
 303  298  sequence in effect in the current locale. If the pattern contains an invalid
 304  299  bracket expression or does not match any existing filenames or pathnames, the
 305  300  pattern string is left unchanged.
 306  301  .RE
 307  302  .SH SEE ALSO
 308      -.sp
 309  303  .LP
 310  304  \fBfind\fR(1), \fBksh\fR(1), \fBfnmatch\fR(3C), \fBregex\fR(5)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX