AlternC/src/mem_del

28 lines
491 B
Plaintext
Raw Normal View History

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