#!/bin/sh
# eclean -- clean up emacs backup files
#
# SYNOPSIS:  Remove files whose names match *~, *.bak, or '#'* from
#       the current working directory.
#	Giving prefixes causes only files with names starting in that list
#	to be removed.
#
# AUTHOR:	Gary T. Leavens
eclean()
{
USAGE="Usage: $0 [prefix ...]"

# no options allowed
case "$1" in
-*)
	echo "$USAGE" >&2
	exit 2
	;;
esac

# all files if no prefix specified
if test $# -eq 0
then
	set '*'
fi

# remove the files
for p
do
	rm -f ${p}~ ${p}.bak '#'${p}*
done
}

[ -n "$echo" ] && set -x

eclean $*

exit 0

