Path: utzoo!utgpu!watmath!att!ucbvax!pasteur!icsib6.Berkeley.EDU!ahmad
From: ahmad@icsib6.Berkeley.EDU (Subutai Ahmad)
Newsgroups: comp.unix.questions
Subject: Re: Directory searching utility
Message-ID: <16156@pasteur.Berkeley.EDU>
Date: 9 Aug 89 18:16:58 GMT
References:  <16137@pasteur.Berkeley.EDU>
Sender: news@pasteur.Berkeley.EDU
Organization: International Computer Science Institute
Lines: 30


du -a | grep '\.[hc]' also works.


#! /bin/sh

# lsd:  search the current directory and all its subdirectories
#       for files which match the arguments.
#

PATH=/bin:/usr/bin

case $* in
        "")     echo "Usage: lsd 'pattern' ..." 1>&2; exit 1 ;;
        -*)     opt="$opt $1" ; shift ;;
esac

for p in $*
do
        case $n in
                "")     n="-name $p" ;;
                *)      n="$n -o -name $p" ;;
        esac
done

find . \( $n \) -exec ls $opt {} \;

--

Subutai Ahmad