Listing 2

:
#
# all [pathname] <asciis | execs | dirs | scripts>
# Add tree search functionality to the asciis, execs, dirs and scripts
# commands.  If [pathname] is not specified, search begins from current 
# working directory "." 
#
if [ $# -lt 1 ]
then
	echo "usage: $0 [pathname] <asciis | execs | dirs | scripts>"
	exit 1
fi

if [ $# -ne 2 ]
then
	TOP="."
	PROG=$1
else
	TOP=$1
	PROG=$2
fi

find $TOP -exec $PROG {} \;

