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