[BACK]Return to find.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / find

Annotation of src/usr.bin/find/find.1, Revision 1.55

1.55    ! jmc         1: .\"    $OpenBSD: find.1,v 1.54 2006/10/02 08:05:32 jmc Exp $
1.1       deraadt     2: .\" Copyright (c) 1990, 1993
                      3: .\"    The Regents of the University of California.  All rights reserved.
                      4: .\"
                      5: .\" This code is derived from software contributed to Berkeley by
                      6: .\" the Institute of Electrical and Electronics Engineers, Inc.
                      7: .\"
                      8: .\" Redistribution and use in source and binary forms, with or without
                      9: .\" modification, are permitted provided that the following conditions
                     10: .\" are met:
                     11: .\" 1. Redistributions of source code must retain the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer.
                     13: .\" 2. Redistributions in binary form must reproduce the above copyright
                     14: .\"    notice, this list of conditions and the following disclaimer in the
                     15: .\"    documentation and/or other materials provided with the distribution.
1.38      millert    16: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    17: .\"    may be used to endorse or promote products derived from this software
                     18: .\"    without specific prior written permission.
                     19: .\"
                     20: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30: .\" SUCH DAMAGE.
                     31: .\"
                     32: .\"    from: @(#)find.1        8.1 (Berkeley) 6/6/93
                     33: .\"
1.24      millert    34: .Dd December 4, 1999
1.1       deraadt    35: .Dt FIND 1
                     36: .Os
                     37: .Sh NAME
                     38: .Nm find
                     39: .Nd walk a file hierarchy
                     40: .Sh SYNOPSIS
                     41: .Nm find
1.48      millert    42: .Op Fl dHhLXx
1.43      jaredy     43: .Op Fl f Ar path
                     44: .Ar path ...\&
1.34      deraadt    45: .Op Ar expression
1.1       deraadt    46: .Sh DESCRIPTION
1.22      aaron      47: .Nm
1.1       deraadt    48: recursively descends the directory tree for each
1.43      jaredy     49: .Ar path
1.1       deraadt    50: listed, evaluating an
                     51: .Ar expression
1.22      aaron      52: (composed of the
                     53: .Dq primaries
                     54: and
1.52      otto       55: .Dq operators
1.22      aaron      56: listed below) in terms
1.12      millert    57: of each file in the tree.
1.34      deraadt    58: In the absence of an expression,
                     59: .Ic -print
                     60: is assumed.
1.1       deraadt    61: .Pp
                     62: The options are as follows:
                     63: .Bl -tag -width Ds
                     64: .It Fl d
1.16      aaron      65: Causes
1.22      aaron      66: .Nm
1.45      jmc        67: to visit directories in post-order
                     68: i.e. all entries in a directory will be acted on before the directory itself.
1.1       deraadt    69: By default,
1.22      aaron      70: .Nm
1.45      jmc        71: visits directories in pre-order i.e. before their contents.
1.43      jaredy     72: .It Fl f Ar path
1.16      aaron      73: Specifies a file hierarchy for
1.22      aaron      74: .Nm
1.1       deraadt    75: to traverse.
1.52      otto       76: File hierarchies may be specified without the
                     77: .Fl f
                     78: option if they are given immediately after any other options.
1.35      millert    79: .It Fl H
                     80: Causes the file information and file type (see
                     81: .Xr stat 2 )
                     82: returned for each symbolic link encountered on the command line to be
                     83: those of the file referenced by the link, not the link itself.
                     84: If the referenced file does not exist, the file information and type will
                     85: be for the link itself.
                     86: File information of all symbolic links not on
                     87: the command line is that of the link itself.
1.1       deraadt    88: .It Fl h
1.35      millert    89: An alias for the
                     90: .Fl L
                     91: option.
1.37      david      92: This option exists for backwards compatibility.
1.35      millert    93: .It Fl L
1.16      aaron      94: Causes the file information and file type (see
1.22      aaron      95: .Xr stat 2 )
1.1       deraadt    96: returned for each symbolic link to be those of the file referenced by the
                     97: link, not the link itself.
                     98: If the referenced file does not exist, the file information and type will
                     99: be for the link itself.
                    100: .It Fl X
1.16      aaron     101: Permit
1.1       deraadt   102: .Nm
                    103: to be safely used in conjunction with
                    104: .Xr xargs 1 .
                    105: If a file name contains any of the delimiting characters used by
                    106: .Xr xargs ,
                    107: a diagnostic message is displayed on standard error, and the file
                    108: is skipped.
1.22      aaron     109: The delimiting characters include single
                    110: .Pq Ql '
                    111: and double
                    112: .Pq Ql \&"
                    113: quotes, backslash
                    114: .Pq Ql \e ,
                    115: space, tab, and newline
                    116: .Pq Sq \en
                    117: characters.
1.41      millert   118: Alternatively, the
1.4       deraadt   119: .Fl print0
1.41      millert   120: primary may be used in conjunction with the
1.4       deraadt   121: .Fl 0
1.41      millert   122: option to
                    123: .Xr xargs 1 ,
                    124: allowing all file names to be processed safely.
1.1       deraadt   125: .It Fl x
1.16      aaron     126: Prevents
1.22      aaron     127: .Nm
1.1       deraadt   128: from descending into directories that have a device number different
                    129: than that of the file from which the descent began.
                    130: .El
                    131: .Sh PRIMARIES
                    132: .Bl -tag -width Ds
1.22      aaron     133: .It Ic -amin Ar n
1.15      deraadt   134: True if the difference between the file last access time and the time
1.22      aaron     135: .Nm
1.20      aaron     136: was started, rounded up to the next full minute, is
1.15      deraadt   137: .Ar n
1.20      aaron     138: minutes.
1.24      millert   139: .It Ic -anewer Ar file
                    140: True if the current file has a more recent last access time than
1.25      aaron     141: .Ar file .
1.22      aaron     142: .It Ic -atime Ar n
1.1       deraadt   143: True if the difference between the file last access time and the time
1.22      aaron     144: .Nm
                    145: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   146: .Ar n
1.22      aaron     147: 24-hour periods.
                    148: .It Ic -cmin Ar n
1.15      deraadt   149: True if the difference between the time of last change of file status
                    150: information and the time
1.22      aaron     151: .Nm
1.20      aaron     152: was started, rounded up to the next full minute, is
1.15      deraadt   153: .Ar n
1.20      aaron     154: minutes.
1.24      millert   155: .It Ic -cnewer Ar file
                    156: True if the current file has a more recent last change time than
1.25      aaron     157: .Ar file .
1.22      aaron     158: .It Ic -ctime Ar n
1.1       deraadt   159: True if the difference between the time of last change of file status
                    160: information and the time
1.22      aaron     161: .Nm
                    162: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   163: .Ar n
1.22      aaron     164: 24-hour periods.
1.8       tholo     165: .It Ic -empty
                    166: True if the current file or directory is empty.
1.22      aaron     167: .It Ic -exec Ar utility Op argument ... ;
1.1       deraadt   168: True if the program named
                    169: .Ar utility
                    170: returns a zero value as its exit status.
                    171: Optional arguments may be passed to the utility.
1.22      aaron     172: The expression must be terminated by a semicolon
                    173: .Pq Ql \&; .
                    174: If the string
                    175: .Qq {}
                    176: appears anywhere in the utility name or the
1.1       deraadt   177: arguments it is replaced by the pathname of the current file.
1.16      aaron     178: .Ar utility
1.1       deraadt   179: will be executed from the directory from which
1.22      aaron     180: .Nm
1.1       deraadt   181: was executed.
1.22      aaron     182: .It Ic -execdir Ar utility Op argument ... ;
                    183: Identical to the
1.10      millert   184: .Ic -exec
                    185: primary with the exception that
1.16      aaron     186: .Ar utility
1.10      millert   187: will be executed from the directory that holds
1.25      aaron     188: the current file.
                    189: The filename substituted for the string
1.22      aaron     190: .Qq {}
                    191: is not qualified.
1.28      millert   192: .It Xo
                    193: .Ic -flags
                    194: .Op Fl
                    195: .Ar flags
                    196: .Xc
                    197: The
                    198: .Ar flags
                    199: are comma-separated symbolic file flags (see
                    200: .Xr chflags 1
                    201: for a list of valid flag names).
                    202: If the flags are preceded by a dash
1.54      jmc       203: .Pq Sq - ,
1.49      otto      204: this primary evaluates to true if at least all specified
                    205: .Ar flags
                    206: are set in the file's flags.
1.28      millert   207: If the flags are not preceded by a dash, this primary evaluates to true if the
                    208: flags specified exactly match those of the file.
1.2       deraadt   209: .It Ic -follow
                    210: Follow symbolic links.
1.22      aaron     211: .It Ic -fstype Ar type
1.1       deraadt   212: True if the file is contained in a file system of type
                    213: .Ar type .
1.22      aaron     214: Two special file system types are recognized:
                    215: .Dq local
                    216: and
                    217: .Dq rdonly .
1.1       deraadt   218: These do not describe actual file system types;
                    219: the former matches any file system physically mounted on the system where
1.22      aaron     220: .Nm
                    221: is being executed whereas the latter matches any file system which is
1.1       deraadt   222: mounted read-only.
1.22      aaron     223: .It Ic -group Ar gname
1.1       deraadt   224: True if the file belongs to the group
1.25      aaron     225: .Ar gname .
1.1       deraadt   226: If
                    227: .Ar gname
                    228: is numeric and there is no such group name, then
                    229: .Ar gname
1.16      aaron     230: is treated as a group ID.
1.27      deraadt   231: .It Ic -iname Ar pattern
                    232: True if the last component of the pathname being examined
                    233: matches
                    234: .Ar pattern .
                    235: Case insensitive.
1.22      aaron     236: .It Ic -inum Ar n
1.1       deraadt   237: True if the file has inode number
1.25      aaron     238: .Ar n .
1.22      aaron     239: .It Ic -links Ar n
1.1       deraadt   240: True if the file has
                    241: .Ar n
                    242: links.
                    243: .It Ic -ls
                    244: This primary always evaluates to true.
                    245: The following information for the current file is written to standard output:
1.22      aaron     246: its inode number, size in 512-byte blocks, file permissions, number of hard
1.1       deraadt   247: links, owner, group, size in bytes, last modification time, and pathname.
                    248: If the file is a block or character special file, the major and minor numbers
                    249: will be displayed instead of the size in bytes.
1.22      aaron     250: If the file is a symbolic link, the pathname of the linked-to file will be
                    251: displayed preceded by
1.54      jmc       252: .Dq -\*(Gt .
1.22      aaron     253: The format is identical to that produced by
1.54      jmc       254: .Dq ls -dgils .
1.6       tholo     255: .It Ic -maxdepth Ar n
1.7       tholo     256: True if the current search depth is less than or equal to what is specified in
                    257: .Ar n .
                    258: .It Ic -mindepth Ar n
                    259: True if the current search depth is at least what is specified in
1.6       tholo     260: .Ar n .
1.22      aaron     261: .It Ic -mmin Ar n
1.15      deraadt   262: True if the difference between the file last modification time and the time
1.22      aaron     263: .Nm
1.20      aaron     264: was started, rounded up to the next full minute, is
1.15      deraadt   265: .Ar n
1.20      aaron     266: minutes.
1.22      aaron     267: .It Ic -mtime Ar n
1.1       deraadt   268: True if the difference between the file last modification time and the time
1.22      aaron     269: .Nm
                    270: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   271: .Ar n
1.22      aaron     272: 24-hour periods.
                    273: .It Ic -name Ar pattern
1.1       deraadt   274: True if the last component of the pathname being examined matches
1.25      aaron     275: .Ar pattern .
1.22      aaron     276: Special shell pattern matching characters
                    277: .Pf ( Ql [ ,
                    278: .Ql \&] ,
                    279: .Ql * ,
                    280: and
1.40      jmc       281: .Ql \&? )
1.1       deraadt   282: may be used as part of
1.25      aaron     283: .Ar pattern .
1.1       deraadt   284: These characters may be matched explicitly by escaping them with a
1.22      aaron     285: backslash
                    286: .Pq Ql \e .
                    287: .It Ic -newer Ar file
1.1       deraadt   288: True if the current file has a more recent last modification time than
1.25      aaron     289: .Ar file .
1.44      jmc       290: .It Ic -nogroup
                    291: True if the file belongs to an unknown group.
1.1       deraadt   292: .It Ic -nouser
                    293: True if the file belongs to an unknown user.
1.54      jmc       294: .It Ic -ok Ar utility Op argument ... ;
1.22      aaron     295: Identical to the
                    296: .Ic -exec
                    297: primary with the exception that
                    298: .Nm
                    299: requests user affirmation for the execution of
                    300: .Ar utility
                    301: by printing
                    302: a message to the terminal and reading a response.
                    303: If the response is other than
                    304: .Sq y
                    305: the command is not executed and the
                    306: value of the
1.54      jmc       307: .Ic ok
1.22      aaron     308: expression is false.
                    309: .It Ic -path Ar pattern
1.1       deraadt   310: True if the pathname being examined matches
1.25      aaron     311: .Ar pattern .
1.22      aaron     312: Special shell pattern matching characters
                    313: .Pf ( Ql [ ,
                    314: .Ql \&] ,
                    315: .Ql * ,
                    316: and
1.40      jmc       317: .Ql \&? )
1.1       deraadt   318: may be used as part of
1.25      aaron     319: .Ar pattern .
1.1       deraadt   320: These characters may be matched explicitly by escaping them with a
1.22      aaron     321: backslash
                    322: .Pq Ql \e .
                    323: Slashes
                    324: .Pq Ql /
                    325: are treated as normal characters and do not have to be
1.1       deraadt   326: matched explicitly.
1.21      aaron     327: .It Xo
                    328: .Ic -perm
                    329: .Op Fl
                    330: .Ar mode
                    331: .Xc
1.1       deraadt   332: The
                    333: .Ar mode
                    334: may be either symbolic (see
1.25      aaron     335: .Xr chmod 1 )
1.1       deraadt   336: or an octal number.
                    337: If the mode is symbolic, a starting value of zero is assumed and the
1.16      aaron     338: mode sets or clears permissions without regard to the process's file mode
1.1       deraadt   339: creation mask.
                    340: If the mode is octal, only bits 07777
                    341: .Pf ( Dv S_ISUID
                    342: |
                    343: .Dv S_ISGID
                    344: |
                    345: .Dv S_ISTXT
                    346: |
                    347: .Dv S_IRWXU
                    348: |
                    349: .Dv S_IRWXG
                    350: |
                    351: .Dv S_IRWXO )
                    352: of the file's mode bits participate
                    353: in the comparison.
1.22      aaron     354: If the mode is preceded by a dash
1.54      jmc       355: .Pq Sq - ,
1.22      aaron     356: this primary evaluates to true
1.1       deraadt   357: if at least all of the bits in the mode are set in the file's mode bits.
1.22      aaron     358: If the mode is not preceded by a dash, this primary evaluates to
1.16      aaron     359: true if the bits in the mode exactly match the file's mode bits.
1.22      aaron     360: Note, the first character of a symbolic mode may not be a dash.
1.1       deraadt   361: .It Ic -print
                    362: This primary always evaluates to true.
                    363: It prints the pathname of the current file to standard output, followed
1.22      aaron     364: by a newline
                    365: .Pq Ql \en
                    366: character.
1.1       deraadt   367: If neither
                    368: .Ic -exec ,
                    369: .Ic -ls ,
                    370: .Ic -ok ,
                    371: nor
                    372: .Ic -print0
                    373: is specified, the given expression shall be effectively replaced by
1.22      aaron     374: .Cm \&( Ns Ar given\& expression Ns Cm \&)
1.1       deraadt   375: .Ic -print .
                    376: .It Ic -print0
                    377: This primary always evaluates to true.
                    378: It prints the pathname of the current file to standard output, followed
                    379: by a null character.
                    380: .It Ic -prune
                    381: This primary always evaluates to true.
                    382: It causes
1.22      aaron     383: .Nm
1.1       deraadt   384: to not descend into the current file.
                    385: Note, the
                    386: .Ic -prune
                    387: primary has no effect if the
                    388: .Fl d
                    389: option was specified.
1.22      aaron     390: .It Ic -size Ar n Ns Op Cm c
                    391: True if the file's size, rounded up, in 512-byte blocks is
1.25      aaron     392: .Ar n .
1.1       deraadt   393: If
                    394: .Ar n
1.22      aaron     395: is followed by a
                    396: .Sq c ,
                    397: then the primary is true if the
1.1       deraadt   398: file's size is
                    399: .Ar n
                    400: bytes.
1.22      aaron     401: .It Ic -type Ar t
1.1       deraadt   402: True if the file is of the specified type.
                    403: Possible file types are as follows:
                    404: .Pp
                    405: .Bl -tag -width flag -offset indent -compact
                    406: .It Cm b
                    407: block special
                    408: .It Cm c
                    409: character special
                    410: .It Cm d
                    411: directory
                    412: .It Cm f
                    413: regular file
                    414: .It Cm l
                    415: symbolic link
                    416: .It Cm p
                    417: FIFO
                    418: .It Cm s
                    419: socket
                    420: .El
                    421: .Pp
1.22      aaron     422: .It Ic -user Ar uname
1.1       deraadt   423: True if the file belongs to the user
1.25      aaron     424: .Ar uname .
1.1       deraadt   425: If
                    426: .Ar uname
                    427: is numeric and there is no such user name, then
                    428: .Ar uname
1.16      aaron     429: is treated as a user ID.
1.1       deraadt   430: .El
                    431: .Pp
                    432: All primaries which take a numeric argument allow the number to be
1.22      aaron     433: preceded by a plus sign
                    434: .Pq Ql +
                    435: or a minus sign
1.54      jmc       436: .Pq Ql - .
1.22      aaron     437: A preceding plus sign means
                    438: .Dq more than n ,
                    439: a preceding minus sign means
                    440: .Dq less than n ,
                    441: and neither means
                    442: .Dq exactly n .
1.1       deraadt   443: .Sh OPERATORS
                    444: The primaries may be combined using the following operators.
                    445: The operators are listed in order of decreasing precedence.
1.47      jmc       446: .Pp
                    447: .Bl -tag -width "(expression)" -compact
1.51      jmc       448: .It Cm \&( Ar expression Cm \&)
1.1       deraadt   449: This evaluates to true if the parenthesized expression evaluates to
                    450: true.
                    451: .Pp
1.51      jmc       452: .It Cm \&! Ar expression
1.1       deraadt   453: This is the unary
                    454: .Tn NOT
                    455: operator.
                    456: It evaluates to true if the expression is false.
                    457: .Pp
1.22      aaron     458: .It Ar expression Cm -and Ar expression
                    459: .It Ar expression expression
1.1       deraadt   460: The
                    461: .Cm -and
                    462: operator is the logical
                    463: .Tn AND
                    464: operator.
                    465: As it is implied by the juxtaposition of two expressions it does not
                    466: have to be specified.
                    467: The expression evaluates to true if both expressions are true.
                    468: The second expression is not evaluated if the first expression is false.
                    469: .Pp
1.22      aaron     470: .It Ar expression Cm -or Ar expression
1.1       deraadt   471: The
                    472: .Cm -or
                    473: operator is the logical
                    474: .Tn OR
                    475: operator.
                    476: The expression evaluates to true if either the first or the second expression
                    477: is true.
                    478: The second expression is not evaluated if the first expression is true.
                    479: .El
                    480: .Pp
1.53      otto      481: Operators, primaries, and arguments to primaries must be separate
                    482: arguments to
                    483: .Nm find ,
                    484: i.e. they should be separated by whitespace.
1.1       deraadt   485: .Sh EXAMPLES
1.22      aaron     486: Print out a list of all the files whose names do not end in
1.43      jaredy    487: .Dq \&.c :
                    488: .Pp
                    489: .Dl "$ find / \e! -name '*.c' -print"
                    490: .Pp
1.22      aaron     491: Print out a list of all the files owned by user
                    492: .Dq wnj
1.43      jaredy    493: that are newer than the file
                    494: .Dq ttt :
                    495: .Pp
                    496: .Dl "$ find / -newer ttt -user wnj -print"
                    497: .Pp
1.22      aaron     498: Print out a list of all the files which are not both newer than
                    499: .Dq ttt
                    500: and owned by
1.43      jaredy    501: .Dq wnj :
                    502: .Pp
                    503: .Dl "$ find / \e! \e( -newer ttt -user wnj \e) -print"
                    504: .Pp
1.22      aaron     505: Print out a list of all the files that are either owned by
                    506: .Dq wnj
                    507: or
                    508: that are newer than
1.43      jaredy    509: .Dq ttt :
                    510: .Pp
                    511: .Dl "$ find / \e( -newer ttt -or -user wnj \e) -print"
                    512: .Pp
                    513: Print out a list of all core files on local file systems:
                    514: .Pp
                    515: .Dl "$ find / \e! -fstype local -prune -or -name '*.core' -print"
1.46      jmc       516: .Pp
                    517: Find all files in
                    518: .Pa /usr/src
                    519: ending in a dot and single digit, but skip directory
                    520: .Pa /usr/src/gnu :
                    521: .Pp
                    522: .Dl "$ find /usr/src -path /usr/src/gnu -prune -or -name \e*\e.[0-9]"
1.1       deraadt   523: .Sh SEE ALSO
1.29      millert   524: .Xr chflags 1 ,
1.1       deraadt   525: .Xr chmod 1 ,
                    526: .Xr locate 1 ,
1.23      aaron     527: .Xr whereis 1 ,
                    528: .Xr which 1 ,
1.41      millert   529: .Xr xargs 1 ,
1.1       deraadt   530: .Xr stat 2 ,
                    531: .Xr fts 3 ,
1.16      aaron     532: .Xr getgrent 3 ,
1.1       deraadt   533: .Xr getpwent 3 ,
                    534: .Xr strmode 3 ,
                    535: .Xr symlink 7
                    536: .Sh STANDARDS
                    537: The
1.22      aaron     538: .Nm
1.1       deraadt   539: utility syntax is a superset of the syntax specified by the
1.55    ! jmc       540: .St -p1003.1-2004
1.1       deraadt   541: standard.
                    542: .Pp
1.55    ! jmc       543: The options
        !           544: .Op Fl dfhXx
        !           545: and primaries
1.18      deraadt   546: .Ic -amin ,
1.55    ! jmc       547: .Ic -anewer ,
1.18      deraadt   548: .Ic -cmin ,
1.55    ! jmc       549: .Ic -cnewer ,
1.9       tholo     550: .Ic -empty ,
1.55    ! jmc       551: .Ic -execdir ,
        !           552: .Ic -flags ,
1.1       deraadt   553: .Ic -follow ,
                    554: .Ic -fstype ,
1.27      deraadt   555: .Ic -iname ,
1.2       deraadt   556: .Ic -inum ,
1.9       tholo     557: .Ic -ls ,
                    558: .Ic -maxdepth ,
1.13      deraadt   559: .Ic -mindepth ,
1.55    ! jmc       560: .Ic -mmin ,
        !           561: .Ic -path ,
1.1       deraadt   562: and
                    563: .Ic -print0
1.13      deraadt   564: are extensions to
1.55    ! jmc       565: .St -p1003.1-2004 .
1.27      deraadt   566: The
                    567: .Ic -iname
                    568: option was inspired by GNU find.
1.1       deraadt   569: .Pp
                    570: Historically, the
                    571: .Fl d ,
1.26      aaron     572: .Fl H ,
1.1       deraadt   573: and
                    574: .Fl x
1.14      deraadt   575: options were implemented using the primaries
                    576: .Ic -depth ,
                    577: .Ic -follow ,
                    578: and
                    579: .Ic -xdev .
1.1       deraadt   580: These primaries always evaluated to true.
                    581: As they were really global variables that took effect before the traversal
                    582: began, some legal expressions could have unexpected results.
1.22      aaron     583: An example is the expression
1.54      jmc       584: .Dq -print -o -depth .
1.22      aaron     585: As
1.54      jmc       586: .Cm -print
1.22      aaron     587: always evaluates to true, the standard order of evaluation
                    588: implies that
1.54      jmc       589: .Cm -depth
1.22      aaron     590: would never be evaluated.
1.1       deraadt   591: This is not the case.
                    592: .Pp
1.22      aaron     593: The operator
                    594: .Cm -or
                    595: was implemented as
1.54      jmc       596: .Cm -o ,
1.22      aaron     597: and the operator
                    598: .Cm -and
                    599: was implemented as
1.54      jmc       600: .Cm -a .
1.1       deraadt   601: .Pp
                    602: Historic implementations of the
                    603: .Ic -exec
                    604: and
                    605: .Ic -ok
1.22      aaron     606: primaries did not replace the string
                    607: .Qq {}
                    608: in the utility name or the
1.1       deraadt   609: utility arguments if it had preceding or following non-whitespace characters.
                    610: This version replaces it no matter where in the utility name or arguments
                    611: it appears.
1.30      aaron     612: .Sh HISTORY
                    613: A
                    614: .Nm
                    615: command appeared in
                    616: .At v1 .
1.50      jmc       617: .Sh CAVEATS
1.1       deraadt   618: The special characters used by
1.22      aaron     619: .Nm
1.1       deraadt   620: are also special characters to many shell programs.
1.22      aaron     621: In particular, the characters
                    622: .Ql * ,
                    623: .Ql [ ,
                    624: .Ql \&] ,
1.40      jmc       625: .Ql \&? ,
1.22      aaron     626: .Ql ( ,
                    627: .Ql \&) ,
1.40      jmc       628: .Ql \&! ,
1.22      aaron     629: .Ql \e ,
                    630: and
                    631: .Ql \&;
                    632: may have to be escaped from the shell.
1.1       deraadt   633: .Pp
                    634: As there is no delimiter separating options and file names or file
                    635: names and the
                    636: .Ar expression ,
1.22      aaron     637: it is difficult to specify files named
                    638: .Dq -xdev
                    639: or
1.40      jmc       640: .Dq \&! .
1.1       deraadt   641: These problems are handled by the
                    642: .Fl f
                    643: option and the
                    644: .Xr getopt 3
1.54      jmc       645: .Dq --
1.22      aaron     646: construct.