Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 1999 17:05:28 -0500
From:      Lucas Bergman <iceberg@pobox.com>
To:        Gary Kline <kline@tera.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: find -f <type>
Message-ID:  <19990826170528.A93854@comp04.prc.uic.edu>
In-Reply-To: <199908262137.OAA20581@athena.tera.com>
References:  <199908262137.OAA20581@athena.tera.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>    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).

HTH,
  Lucas
-- 
                             S. Lucas Bergman
                             University of Illinois at Chicago
                             Mathematics Department
                             PGP Public Key (0xC0C73619):
                                finger -l lucas@math.uic.edu


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990826170528.A93854>