#!/bin/sh
# $NetBSD: script,v 1.2 2002/07/26 07:29:06 jdolecek Exp $

if [ "$1" = "" ]; then
	echo "No host selected"
	exit 0
fi

DATA=`echo $1 | sed -e 's@ @\[^A-Za-z0-9_/\\.-\]\*@g'`
LIST=`echo $DATA | sed -e 's@,@.*//" | sed -e "s/^@g'`
LIST=`echo 'sed -e "s/^'$LIST'.*//"'`
IFS=" "
HOSTS=`cat /etc/hosts`
echo $HOSTS | eval "$LIST" >/etc/hosts
if [ "$?" = "0" ]; then
	echo "Deleted all selected hosts from /etc/hosts"
else
	echo "Failed to delete hosts"
fi
