Re: Profanity in the Linux Kernel?!?!?

Tim Smith (tzs@tzs.net)
Thu, 10 Jun 1999 20:02:29 -0700 (PDT)


On Thu, 10 Jun 1999, Arvind Sankar wrote:
> > >> cd /usr/src/linux ; grep -i fuck `find . -name '*.[ch]'`
...
> > > find /usr/src/linux -name '*.[ch]' -exec grep -i fuck {} \;
...
> > Q> find /usr/src/linux -name '*.[ch]' -exec grep -i fuck '{}' \;
...
> While we're being pedantic, notice that the last form won't work if
> /usr/src/linux happens to be a symlink. So
>
> cd /usr/src/linux && find . -type f -a \! -name \*.o -a \! -name \*.a \
> -a \! -name vmlin\* | xargs grep -i fuck

If we want to be *really* pedantic, a couple more things are needed to get
this right:

1. Add "-print0" to the find, and "-0" to xargs, so that filenames with
funny characters won't cause problems.

2. It should be "grep -i fuck /dev/null", because it is possible that xargs
will run an instance of grep with only one argument from the find, and
then grep would not print the file name if it contained "fuck".

--Tim Smith

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/