[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.41

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