On Tue, Sep 14, 2010 at 04:54:06PM +0200, Joachim Schipper wrote:
>
> I don't disagree with you that this is already in the man page; but this
> change will prevent people from making the same mistake (i.e. has an
> upside) and doesn't appear to have any significant downsides (unlike the
> second diff, the first adds very little text to the page.)
>
> You seem a reasonable enough fellow, and I see you've worked on find.1
> in the past. I don't see why you're so adamantly opposed. Care to
> enlighten me?
>
sorry, i'm just tired.
i'm not opposed to any changes that are improvements. i just objected to
parts of your diff, for the reasons i gave.
>
> Would you be happier with a version with less repetition? The following
> diff is like the one I sent out earlier, but
> - shorten the reference from "-X" to "-print0"
> - removes the warning from the description of -print (people using
> "-print" instead of letting find(1) add it by default will probably
> look at CAVEATS too);
>
> With the attached diff, the man page refers to this issue in "-X" and
> "-print0" and CAVEATS; would you like to see it removed from one of
> these places?
>
well, it kind of is only in CAVEATS now. so that seems alright.
> Joachim
>
> Index: find.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/find/find.1,v
> retrieving revision 1.78
> diff -u -p -r1.78 find.1
> --- find.1 15 Jul 2010 20:51:38 -0000 1.78
> +++ find.1 14 Sep 2010 14:49:42 -0000
> @@ -126,13 +126,9 @@ quotes, backslash
> space, tab, and newline
> .Pq Sq \en
> characters.
> -Alternatively, the
> +Consider using
> .Fl print0
> -primary may be used in conjunction with the
> -.Fl 0
> -option to
> -.Xr xargs 1 ,
> -allowing all file names to be processed safely.
> +instead.
> .It Fl x
> Prevents
> .Nm
> @@ -386,7 +382,10 @@ character.
> .It Ic -print0
> This primary always evaluates to true.
> It prints the pathname of the current file to standard output, followed
> -by a null character.
> +by a null character, suitable for use with the
> +.Fl 0
> +option to
> +.Xr xargs 1 .
so, these two changes make sense i think.
> .It Ic -prune
> This primary always evaluates to true.
> It causes
> @@ -525,11 +524,13 @@ ending in a dot and single digit, but sk
> .Pp
> .Dl "$ find /usr/src -path /usr/src/gnu -prune -or -name \e*.[0-9]"
> .Pp
> -Find and remove all *.jpg files in the current working directory:
> +Find and remove all *.jpg and *.gif files under the current working
> +directory
> +.Pq see also Sx CAVEATS :
here i agree only with the in->under change.
again i say that we correctly document -and and -or, and give an
example.
i don't say this change is wrong, i just don;t see the need for it.
if other people like it, it can go in.
> .Pp
> -.Dl "$ find . -name \e*.jpg -exec rm {} \e;"
> +.Dl "$ find . \e( -name \e*.jpg -o -name \e*.gif \e) -exec rm {} \e;
> or
> -.Dl "$ find . -name \e*.jpg | xargs rm"
> +.Dl "$ find . \e( -name \e*.jpg -o -name \e*.gif \e) -print0 | xargs -0r rm"
i guess adding the -print0 stuff can;t hurt though.
> .Sh SEE ALSO
> .Xr chflags 1 ,
> .Xr chmod 1 ,
> @@ -637,6 +638,25 @@ In particular, the characters
> and
> .Ql \&;
> may have to be escaped from the shell.
> +.Pp
> +Using
> +.Nm
> +in combination with
> +other programs requires some care:
is it only rm or other programs?
> +.Pp
> +.Dl "$ find . -name \e*.jpg | xargs rm"
> +or
> +.Dl "$ rm `find . -name \e*.jpg`"
> +.Pp
> +would, given a file named
> +.Pa "important .jpg"
> +(with a space character in the middle), remove
it will probably be clearer if you use Dq and just remove the stuff in
brackets.
> +.Pa important .
only if there was a file called "important". the example might be better
if you said, given files names "important .jpg" and "important", remove
"important".
> +Use the
> +.Ic -print0
> +or
> +.Ic -exec
> +primaries instead.
> .Pp
> As there is no delimiter separating options and file names or file
> names and the
jmc