#!/bin/sh
# top - list the newest entries in the directory
#       by default, list only the latest 10 entries
#       the number of entries can be specified by the 1st argument
#
# Written by Ronald Joe Record (rr@sco.com)
#

NUM=11
ARGS=-t
DIR=
ALL=

while case "$1" in
	"") break
		;;
	all) ALL=1
		;;
	-*) ARGS="$ARGS $1"
		;;
	[0-9]*)  NUM=$1
		;;
	*)  DIR="$DIR $1"
		;;
	esac
do
	shift
done

[ "$DIR" ] || DIR=`pwd`


for d in $DIR
do
	if [ "$ALL" ]
	then
	    ls ${ARGS} $d
	else
	    echo "\nMost recent $NUM files in $d :\n"
	    ls ${ARGS} $d | head -$NUM
	fi
done
