#!/bin/bash

ID=`/usr/bin/id -u`
        [ $ID -ne 0 ]  && echo "You must sudo to run $0." && exit
echo "Enter ID:"
read -p ""
SHOPCODE=$REPLY
#if [ ${#SHOPCODE} != 8 ] ; then
#echo "ID must be 8 characters."
#exit
#fi
if [ -d /backups/tfrsync-$SHOPCODE ] ; then
echo "Remove data as well? y/n"
read -p ""
if [ "$REPLY" == "y" ] ; then
userdel -r tfrsync-$SHOPCODE
else
userdel tfrsync-$SHOPCODE
rm -rf /backups/tfrsync-$SHOPCODE/.ssh
rm -f /var/spool/mail/tfrsync-$SHOPCODE
fi
echo "Cloud account tfrsync-$SHOPCODE removed."
exit
else
echo "Cloud account doesn't exist."
fi
