From owner-freebsd-questions Thu Aug 26 15:57:59 1999 Delivered-To: freebsd-questions@freebsd.org Received: from gershwin.tera.com (gershwin.tera.com [207.224.230.28]) by hub.freebsd.org (Postfix) with ESMTP id AF848154BF for ; Thu, 26 Aug 1999 15:57:52 -0700 (PDT) (envelope-from kline@tera.com) Received: from athena.tera.com (athena.tera.com [207.224.230.169]) by gershwin.tera.com (8.8.8/8.8.8) with ESMTP id PAA02822; Thu, 26 Aug 1999 15:56:22 -0700 (PDT) From: Gary Kline Received: (from kline@localhost) by athena.tera.com (8.7.5/8.7.3) id PAA24088; Thu, 26 Aug 1999 15:56:21 -0700 (PDT) Message-Id: <199908262256.PAA24088@athena.tera.com> Subject: Re: find -f In-Reply-To: <19990826170528.A93854@comp04.prc.uic.edu> from Lucas Bergman at "Aug 26, 99 05:05:28 pm" To: iceberg@pobox.com Date: Thu, 26 Aug 1999 15:56:21 -0700 (PDT) Cc: kline@tera.com, freebsd-questions@freebsd.org X-Mailer: ELM [version 2.4ME+ PL23 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG According to Lucas Bergman: > > Is there a way of using find to locate all regular files that > > are not binaries and also not executable scripts? > > The following script (I think) echoes the name of all files off the > current directory that are text and have no executable bits set. I > didn't test it that rigorously, so YMMV. > > ------------ snip snip snip ------------ > #!/bin/sh > > list=`find . \( -type f -and \! -perm -001 \ > -and \! -perm -010 -and \! -perm -100 \) -print` > > for file in $list > do > if { file $file | grep -i text 2>&1 >/dev/null; } > then > echo $file > fi > done > ------------ snip snip snip ------------ > > Don't count on running this too often, though, cuz it is Slower Than > Windows (TM). > Yup, works, thanks much. Years ago, 8-10-12, whatever, a shell wiz hacked out something similar that caught only /bin/sh scripts and COFF binaries. Yours, using the ``-perm'' switch is better. find is great; having something like this builtin would be a win... but maybe be a bit too much feature-creep! gary To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message