Directory searching utility

Subutai Ahmad ahmad at icsib6.Berkeley.EDU
Thu Aug 10 04:16:58 AEST 1989


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



More information about the Comp.unix.questions mailing list