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

1.57    ! otto        1: .\"    $OpenBSD: find.1,v 1.56 2006/10/05 07:41:04 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.56      jmc       165: .It Ic -depth
                    166: The same as specifying the
                    167: .Fl d
                    168: option.
1.8       tholo     169: .It Ic -empty
                    170: True if the current file or directory is empty.
1.22      aaron     171: .It Ic -exec Ar utility Op argument ... ;
1.1       deraadt   172: True if the program named
                    173: .Ar utility
                    174: returns a zero value as its exit status.
                    175: Optional arguments may be passed to the utility.
1.22      aaron     176: The expression must be terminated by a semicolon
                    177: .Pq Ql \&; .
                    178: If the string
                    179: .Qq {}
                    180: appears anywhere in the utility name or the
1.1       deraadt   181: arguments it is replaced by the pathname of the current file.
1.16      aaron     182: .Ar utility
1.1       deraadt   183: will be executed from the directory from which
1.22      aaron     184: .Nm
1.1       deraadt   185: was executed.
1.22      aaron     186: .It Ic -execdir Ar utility Op argument ... ;
                    187: Identical to the
1.10      millert   188: .Ic -exec
                    189: primary with the exception that
1.16      aaron     190: .Ar utility
1.10      millert   191: will be executed from the directory that holds
1.25      aaron     192: the current file.
                    193: The filename substituted for the string
1.22      aaron     194: .Qq {}
                    195: is not qualified.
1.28      millert   196: .It Xo
                    197: .Ic -flags
                    198: .Op Fl
                    199: .Ar flags
                    200: .Xc
                    201: The
                    202: .Ar flags
                    203: are comma-separated symbolic file flags (see
                    204: .Xr chflags 1
                    205: for a list of valid flag names).
                    206: If the flags are preceded by a dash
1.54      jmc       207: .Pq Sq - ,
1.49      otto      208: this primary evaluates to true if at least all specified
                    209: .Ar flags
                    210: are set in the file's flags.
1.28      millert   211: If the flags are not preceded by a dash, this primary evaluates to true if the
                    212: flags specified exactly match those of the file.
1.2       deraadt   213: .It Ic -follow
1.56      jmc       214: The same as specifying the
                    215: .Fl H
                    216: option.
1.22      aaron     217: .It Ic -fstype Ar type
1.1       deraadt   218: True if the file is contained in a file system of type
                    219: .Ar type .
1.22      aaron     220: Two special file system types are recognized:
                    221: .Dq local
                    222: and
                    223: .Dq rdonly .
1.1       deraadt   224: These do not describe actual file system types;
                    225: the former matches any file system physically mounted on the system where
1.22      aaron     226: .Nm
                    227: is being executed whereas the latter matches any file system which is
1.1       deraadt   228: mounted read-only.
1.22      aaron     229: .It Ic -group Ar gname
1.1       deraadt   230: True if the file belongs to the group
1.25      aaron     231: .Ar gname .
1.1       deraadt   232: If
                    233: .Ar gname
                    234: is numeric and there is no such group name, then
                    235: .Ar gname
1.16      aaron     236: is treated as a group ID.
1.27      deraadt   237: .It Ic -iname Ar pattern
                    238: True if the last component of the pathname being examined
                    239: matches
                    240: .Ar pattern .
                    241: Case insensitive.
1.22      aaron     242: .It Ic -inum Ar n
1.1       deraadt   243: True if the file has inode number
1.25      aaron     244: .Ar n .
1.22      aaron     245: .It Ic -links Ar n
1.1       deraadt   246: True if the file has
                    247: .Ar n
                    248: links.
                    249: .It Ic -ls
                    250: This primary always evaluates to true.
                    251: The following information for the current file is written to standard output:
1.22      aaron     252: its inode number, size in 512-byte blocks, file permissions, number of hard
1.1       deraadt   253: links, owner, group, size in bytes, last modification time, and pathname.
                    254: If the file is a block or character special file, the major and minor numbers
                    255: will be displayed instead of the size in bytes.
1.22      aaron     256: If the file is a symbolic link, the pathname of the linked-to file will be
                    257: displayed preceded by
1.54      jmc       258: .Dq -\*(Gt .
1.22      aaron     259: The format is identical to that produced by
1.54      jmc       260: .Dq ls -dgils .
1.6       tholo     261: .It Ic -maxdepth Ar n
1.7       tholo     262: True if the current search depth is less than or equal to what is specified in
                    263: .Ar n .
                    264: .It Ic -mindepth Ar n
                    265: True if the current search depth is at least what is specified in
1.6       tholo     266: .Ar n .
1.22      aaron     267: .It Ic -mmin Ar n
1.15      deraadt   268: True if the difference between the file last modification time and the time
1.22      aaron     269: .Nm
1.20      aaron     270: was started, rounded up to the next full minute, is
1.15      deraadt   271: .Ar n
1.20      aaron     272: minutes.
1.22      aaron     273: .It Ic -mtime Ar n
1.1       deraadt   274: True if the difference between the file last modification time and the time
1.22      aaron     275: .Nm
                    276: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   277: .Ar n
1.22      aaron     278: 24-hour periods.
                    279: .It Ic -name Ar pattern
1.1       deraadt   280: True if the last component of the pathname being examined matches
1.25      aaron     281: .Ar pattern .
1.22      aaron     282: Special shell pattern matching characters
                    283: .Pf ( Ql [ ,
                    284: .Ql \&] ,
                    285: .Ql * ,
                    286: and
1.40      jmc       287: .Ql \&? )
1.1       deraadt   288: may be used as part of
1.25      aaron     289: .Ar pattern .
1.1       deraadt   290: These characters may be matched explicitly by escaping them with a
1.22      aaron     291: backslash
                    292: .Pq Ql \e .
                    293: .It Ic -newer Ar file
1.1       deraadt   294: True if the current file has a more recent last modification time than
1.25      aaron     295: .Ar file .
1.44      jmc       296: .It Ic -nogroup
                    297: True if the file belongs to an unknown group.
1.1       deraadt   298: .It Ic -nouser
                    299: True if the file belongs to an unknown user.
1.54      jmc       300: .It Ic -ok Ar utility Op argument ... ;
1.22      aaron     301: Identical to the
                    302: .Ic -exec
                    303: primary with the exception that
                    304: .Nm
                    305: requests user affirmation for the execution of
                    306: .Ar utility
                    307: by printing
                    308: a message to the terminal and reading a response.
                    309: If the response is other than
                    310: .Sq y
                    311: the command is not executed and the
                    312: value of the
1.54      jmc       313: .Ic ok
1.22      aaron     314: expression is false.
                    315: .It Ic -path Ar pattern
1.1       deraadt   316: True if the pathname being examined matches
1.25      aaron     317: .Ar pattern .
1.22      aaron     318: Special shell pattern matching characters
                    319: .Pf ( Ql [ ,
                    320: .Ql \&] ,
                    321: .Ql * ,
                    322: and
1.40      jmc       323: .Ql \&? )
1.1       deraadt   324: may be used as part of
1.25      aaron     325: .Ar pattern .
1.1       deraadt   326: These characters may be matched explicitly by escaping them with a
1.22      aaron     327: backslash
                    328: .Pq Ql \e .
                    329: Slashes
                    330: .Pq Ql /
                    331: are treated as normal characters and do not have to be
1.1       deraadt   332: matched explicitly.
1.21      aaron     333: .It Xo
                    334: .Ic -perm
                    335: .Op Fl
                    336: .Ar mode
                    337: .Xc
1.1       deraadt   338: The
                    339: .Ar mode
                    340: may be either symbolic (see
1.25      aaron     341: .Xr chmod 1 )
1.1       deraadt   342: or an octal number.
                    343: If the mode is symbolic, a starting value of zero is assumed and the
1.16      aaron     344: mode sets or clears permissions without regard to the process's file mode
1.1       deraadt   345: creation mask.
                    346: If the mode is octal, only bits 07777
                    347: .Pf ( Dv S_ISUID
                    348: |
                    349: .Dv S_ISGID
                    350: |
                    351: .Dv S_ISTXT
                    352: |
                    353: .Dv S_IRWXU
                    354: |
                    355: .Dv S_IRWXG
                    356: |
                    357: .Dv S_IRWXO )
                    358: of the file's mode bits participate
                    359: in the comparison.
1.22      aaron     360: If the mode is preceded by a dash
1.54      jmc       361: .Pq Sq - ,
1.22      aaron     362: this primary evaluates to true
1.1       deraadt   363: if at least all of the bits in the mode are set in the file's mode bits.
1.22      aaron     364: If the mode is not preceded by a dash, this primary evaluates to
1.16      aaron     365: true if the bits in the mode exactly match the file's mode bits.
1.22      aaron     366: Note, the first character of a symbolic mode may not be a dash.
1.1       deraadt   367: .It Ic -print
                    368: This primary always evaluates to true.
                    369: It prints the pathname of the current file to standard output, followed
1.22      aaron     370: by a newline
                    371: .Pq Ql \en
                    372: character.
1.1       deraadt   373: If neither
                    374: .Ic -exec ,
                    375: .Ic -ls ,
                    376: .Ic -ok ,
                    377: nor
                    378: .Ic -print0
                    379: is specified, the given expression shall be effectively replaced by
1.22      aaron     380: .Cm \&( Ns Ar given\& expression Ns Cm \&)
1.1       deraadt   381: .Ic -print .
                    382: .It Ic -print0
                    383: This primary always evaluates to true.
                    384: It prints the pathname of the current file to standard output, followed
                    385: by a null character.
                    386: .It Ic -prune
                    387: This primary always evaluates to true.
                    388: It causes
1.22      aaron     389: .Nm
1.1       deraadt   390: to not descend into the current file.
                    391: Note, the
                    392: .Ic -prune
                    393: primary has no effect if the
                    394: .Fl d
                    395: option was specified.
1.22      aaron     396: .It Ic -size Ar n Ns Op Cm c
                    397: True if the file's size, rounded up, in 512-byte blocks is
1.25      aaron     398: .Ar n .
1.1       deraadt   399: If
                    400: .Ar n
1.22      aaron     401: is followed by a
                    402: .Sq c ,
                    403: then the primary is true if the
1.1       deraadt   404: file's size is
                    405: .Ar n
                    406: bytes.
1.22      aaron     407: .It Ic -type Ar t
1.1       deraadt   408: True if the file is of the specified type.
                    409: Possible file types are as follows:
                    410: .Pp
                    411: .Bl -tag -width flag -offset indent -compact
                    412: .It Cm b
                    413: block special
                    414: .It Cm c
                    415: character special
                    416: .It Cm d
                    417: directory
                    418: .It Cm f
                    419: regular file
                    420: .It Cm l
                    421: symbolic link
                    422: .It Cm p
                    423: FIFO
                    424: .It Cm s
                    425: socket
                    426: .El
                    427: .Pp
1.22      aaron     428: .It Ic -user Ar uname
1.1       deraadt   429: True if the file belongs to the user
1.25      aaron     430: .Ar uname .
1.1       deraadt   431: If
                    432: .Ar uname
                    433: is numeric and there is no such user name, then
                    434: .Ar uname
1.16      aaron     435: is treated as a user ID.
1.56      jmc       436: .It Ic -xdev
                    437: The same as specifying the
                    438: .Fl x
                    439: option.
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
1.54      jmc       446: .Pq Ql - .
1.22      aaron     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.47      jmc       456: .Pp
                    457: .Bl -tag -width "(expression)" -compact
1.51      jmc       458: .It Cm \&( Ar expression Cm \&)
1.1       deraadt   459: This evaluates to true if the parenthesized expression evaluates to
                    460: true.
                    461: .Pp
1.51      jmc       462: .It Cm \&! Ar expression
1.1       deraadt   463: This is the unary
                    464: .Tn NOT
                    465: operator.
                    466: It evaluates to true if the expression is false.
                    467: .Pp
1.22      aaron     468: .It Ar expression Cm -and Ar expression
                    469: .It Ar expression expression
1.1       deraadt   470: The
                    471: .Cm -and
                    472: operator is the logical
                    473: .Tn AND
                    474: operator.
                    475: As it is implied by the juxtaposition of two expressions it does not
                    476: have to be specified.
                    477: The expression evaluates to true if both expressions are true.
                    478: The second expression is not evaluated if the first expression is false.
                    479: .Pp
1.22      aaron     480: .It Ar expression Cm -or Ar expression
1.1       deraadt   481: The
                    482: .Cm -or
                    483: operator is the logical
                    484: .Tn OR
                    485: operator.
                    486: The expression evaluates to true if either the first or the second expression
                    487: is true.
                    488: The second expression is not evaluated if the first expression is true.
                    489: .El
                    490: .Pp
1.53      otto      491: Operators, primaries, and arguments to primaries must be separate
                    492: arguments to
                    493: .Nm find ,
                    494: i.e. they should be separated by whitespace.
1.1       deraadt   495: .Sh EXAMPLES
1.22      aaron     496: Print out a list of all the files whose names do not end in
1.43      jaredy    497: .Dq \&.c :
                    498: .Pp
                    499: .Dl "$ find / \e! -name '*.c' -print"
                    500: .Pp
1.22      aaron     501: Print out a list of all the files owned by user
                    502: .Dq wnj
1.43      jaredy    503: that are newer than the file
                    504: .Dq ttt :
                    505: .Pp
                    506: .Dl "$ find / -newer ttt -user wnj -print"
                    507: .Pp
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
1.43      jaredy    511: .Dq wnj :
                    512: .Pp
                    513: .Dl "$ find / \e! \e( -newer ttt -user wnj \e) -print"
                    514: .Pp
1.22      aaron     515: Print out a list of all the files that are either owned by
                    516: .Dq wnj
                    517: or
                    518: that are newer than
1.43      jaredy    519: .Dq ttt :
                    520: .Pp
                    521: .Dl "$ find / \e( -newer ttt -or -user wnj \e) -print"
                    522: .Pp
                    523: Print out a list of all core files on local file systems:
                    524: .Pp
                    525: .Dl "$ find / \e! -fstype local -prune -or -name '*.core' -print"
1.46      jmc       526: .Pp
                    527: Find all files in
                    528: .Pa /usr/src
                    529: ending in a dot and single digit, but skip directory
                    530: .Pa /usr/src/gnu :
                    531: .Pp
                    532: .Dl "$ find /usr/src -path /usr/src/gnu -prune -or -name \e*\e.[0-9]"
1.1       deraadt   533: .Sh SEE ALSO
1.29      millert   534: .Xr chflags 1 ,
1.1       deraadt   535: .Xr chmod 1 ,
                    536: .Xr locate 1 ,
1.23      aaron     537: .Xr whereis 1 ,
                    538: .Xr which 1 ,
1.41      millert   539: .Xr xargs 1 ,
1.1       deraadt   540: .Xr stat 2 ,
                    541: .Xr fts 3 ,
1.16      aaron     542: .Xr getgrent 3 ,
1.1       deraadt   543: .Xr getpwent 3 ,
                    544: .Xr strmode 3 ,
                    545: .Xr symlink 7
                    546: .Sh STANDARDS
                    547: The
1.22      aaron     548: .Nm
1.1       deraadt   549: utility syntax is a superset of the syntax specified by the
1.55      jmc       550: .St -p1003.1-2004
1.1       deraadt   551: standard.
                    552: .Pp
1.55      jmc       553: The options
                    554: .Op Fl dfhXx
                    555: and primaries
1.18      deraadt   556: .Ic -amin ,
1.55      jmc       557: .Ic -anewer ,
1.18      deraadt   558: .Ic -cmin ,
1.55      jmc       559: .Ic -cnewer ,
1.9       tholo     560: .Ic -empty ,
1.55      jmc       561: .Ic -execdir ,
                    562: .Ic -flags ,
1.1       deraadt   563: .Ic -follow ,
                    564: .Ic -fstype ,
1.27      deraadt   565: .Ic -iname ,
1.2       deraadt   566: .Ic -inum ,
1.9       tholo     567: .Ic -ls ,
                    568: .Ic -maxdepth ,
1.13      deraadt   569: .Ic -mindepth ,
1.55      jmc       570: .Ic -mmin ,
                    571: .Ic -path ,
1.1       deraadt   572: and
                    573: .Ic -print0
1.13      deraadt   574: are extensions to
1.55      jmc       575: .St -p1003.1-2004 .
1.27      deraadt   576: The
                    577: .Ic -iname
1.57    ! otto      578: primary was inspired by GNU find.
1.1       deraadt   579: .Pp
                    580: Historically, the
                    581: .Fl d ,
1.26      aaron     582: .Fl H ,
1.1       deraadt   583: and
                    584: .Fl x
1.14      deraadt   585: options were implemented using the primaries
                    586: .Ic -depth ,
                    587: .Ic -follow ,
                    588: and
                    589: .Ic -xdev .
1.1       deraadt   590: These primaries always evaluated to true.
                    591: As they were really global variables that took effect before the traversal
                    592: began, some legal expressions could have unexpected results.
1.22      aaron     593: An example is the expression
1.54      jmc       594: .Dq -print -o -depth .
1.22      aaron     595: As
1.54      jmc       596: .Cm -print
1.22      aaron     597: always evaluates to true, the standard order of evaluation
                    598: implies that
1.54      jmc       599: .Cm -depth
1.22      aaron     600: would never be evaluated.
1.1       deraadt   601: This is not the case.
                    602: .Pp
1.22      aaron     603: The operator
                    604: .Cm -or
                    605: was implemented as
1.54      jmc       606: .Cm -o ,
1.22      aaron     607: and the operator
                    608: .Cm -and
                    609: was implemented as
1.54      jmc       610: .Cm -a .
1.1       deraadt   611: .Pp
                    612: Historic implementations of the
                    613: .Ic -exec
                    614: and
                    615: .Ic -ok
1.22      aaron     616: primaries did not replace the string
                    617: .Qq {}
                    618: in the utility name or the
1.1       deraadt   619: utility arguments if it had preceding or following non-whitespace characters.
                    620: This version replaces it no matter where in the utility name or arguments
                    621: it appears.
1.30      aaron     622: .Sh HISTORY
                    623: A
                    624: .Nm
                    625: command appeared in
                    626: .At v1 .
1.50      jmc       627: .Sh CAVEATS
1.1       deraadt   628: The special characters used by
1.22      aaron     629: .Nm
1.1       deraadt   630: are also special characters to many shell programs.
1.22      aaron     631: In particular, the characters
                    632: .Ql * ,
                    633: .Ql [ ,
                    634: .Ql \&] ,
1.40      jmc       635: .Ql \&? ,
1.22      aaron     636: .Ql ( ,
                    637: .Ql \&) ,
1.40      jmc       638: .Ql \&! ,
1.22      aaron     639: .Ql \e ,
                    640: and
                    641: .Ql \&;
                    642: may have to be escaped from the shell.
1.1       deraadt   643: .Pp
                    644: As there is no delimiter separating options and file names or file
                    645: names and the
                    646: .Ar expression ,
1.22      aaron     647: it is difficult to specify files named
                    648: .Dq -xdev
                    649: or
1.40      jmc       650: .Dq \&! .
1.1       deraadt   651: These problems are handled by the
                    652: .Fl f
                    653: option and the
                    654: .Xr getopt 3
1.54      jmc       655: .Dq --
1.22      aaron     656: construct.