#!/bin/sh
# --- Copyright University of Sussex 1994. All rights reserved. ----------
# File:             C.unix/com/pu
# Purpose:          purge old files with trailing -'s
# Author:           Unknown, ??? (see revisions)
# Documentation:    HELP * PURGE

case $1 in
	-*) case $1 in
			-3) num="---"
				;;
			-2) num="--"
				;;
			-1) num="-"
				;;
			*)  echo "pu: unknown option " $1;
				exit 1
			;;
		esac;
		shift
		;;
	*)  num="-"
		;;
esac;

if [ $# -eq 0 ]; then
	rm -f *$num
else
	while [ $# -ne 0 ]; do
		if [ -d $1 ]; then
			rm -f $1/*$num
		else
			rm -f $1$num----- $1$num---- $1$num--- $1$num-- $1$num- $1$num
		fi
		shift
	done
fi



# --- Revision History ---------------------------------------------------
# --- John Gibson, Dec  7 1994
#		Made it deal with multiple args. If arg a directory, deletes *$num
#		in that dir. With a file arg, behaves consistently with dir arg or
#		no arg, by deleting all older back files as well
# --- Mark Rubinstein, Jan 20 1986 - rewritten in SHell
