Bug 39532

Summary: 'find' man page should
Product: Documentation Reporter: Soren Spies <sspies>
Component: Books & ArticlesAssignee: Tom Rhodes <trhodes>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
find.1-patch none

Description Soren Spies 2002-06-19 18:00:02 UTC
One common use of 'find' is with the -exec flag.  It's rather tricky to get right for the novice (the \; gets most people the first time) and thus would be an excellent flag to document in the find(1) man page's EXAMPLES section.

The current man pages (FreeBSD 4.5 and 4.6) don't show the \; and only obliquely refers to the need for special quoting: "Optional arguments may be passed to the utility.  The expression must be terminated by a semicolon (``;'')."

Fix: 

add an example to the EXAMPLES section:
        find . -type d -exec chmod g-w {} \;
How-To-Repeat: man find
*think* "-exec looks cool"
try to use it: find . -type f -exec chmod g-w {} ;
find: -exec: no terminating ";"

wonder why it failed ... eventually resort to finding someone more knowledgable, general sadness, lack of confidence, etc.  :)
Comment 1 Christophe Juniet 2002-09-10 11:50:10 UTC
You can use this patch, for instance:

--- patch begins here ---
--- src/usr.bin/find/find.1     Tue Aug 27 21:14:08 2002
+++ /home/chris/work/find.1     Tue Sep 10 12:30:20 2002
@@ -738,6 +738,9 @@
  .It Li "find . -newerct '1 minute ago' -print"
  Print out a list of all the files whose inode change time is more
  recent than the current time minus one minute.
+.It Li "find . -type d -exec chmod go-w \e{\e} \e;"
+Deny write permission to group and others on the current directory
+and all its sub-directories.
  .El
  .Sh SEE ALSO
  .Xr chflags 1 ,
--- patch ends here ---

-- 
chris
Comment 2 Marc Silver 2004-02-02 19:50:27 UTC
Hi there,

I've made some modifications to the patch supplied:

  1) I personally feel the example should be something harmless.  Users
     running the previous example may find themselves in a sticky
     situation if they ran the example in the wrong directory not fully
     understanding what it does.  The example I've submitted is
     harmless.

  2) An example in the current man page references "." as a starting
     point, while all the others use "/".  I've changed the example to
     also use "/" as it seems more in line with the others.

Cheers,
Marc
Comment 3 Tom Rhodes freebsd_committer freebsd_triage 2004-02-05 17:45:06 UTC
Responsible Changed
From-To: freebsd-doc->trhodes

Take this PR.
Comment 4 Tom Rhodes freebsd_committer freebsd_triage 2004-02-27 20:11:13 UTC
State Changed
From-To: open->patched

Patch applied; thanks for the submission!
Comment 5 Tom Rhodes freebsd_committer freebsd_triage 2004-03-04 12:03:33 UTC
State Changed
From-To: patched->closed

MFC Complete!