if [ "$1" = "" ] ; then echo need filename as argument; exit 1 ; fi

if test -f $1
then
{

echo are you sure y/n?
read something

if [ "$something" = "y" ];then
{

if test -f ~/trash/$1; then
{
filename=$1
#test if already a file like that in the trash
while test -f ~/trash/$filename
do
echo file $filename already exists in trash,
echo  give a new file name for old trash file?
read filename
done

mv ~/trash/$1 ~/trash/$filename
echo renamed trash/$1 trash/$filename
}
fi

cp $1 ~/trash/
rm $1
if [ "$1" != "" ] ; then echo file $1 deleted; fi
}
else
echo file $1 not deleted
fi

}
else
echo file $1 does not exist
fi

