AlternC/src/mem_del

28 lines
491 B
Bash
Executable File

#!/bin/bash
if [ $# -ne 2 ] ; then
echo "Usage: mem_del <name>"
echo " Delete the AlternC account <name>"
exit 1
fi
name="$1"
if [[ ! "$name" =~ ^([a-z0-9]+)$ ]] ; then
echo "Account name is incorrect."
exit 2
fi
if [[ ! "$(id -u)" == "0" ]] ; then
echo "please launch mem_del as root (or using sudo)"
exit 4
fi
# Get the vars and some functions
source /usr/lib/alternc/functions.sh
target="$(get_html_path_by_name "$name")"
test -d "$target" && rm -rf "$target"