+#!/bin/bash
+#
+# What: delrepo
+# Date: 27 Sept 2024
+# Author: Christian Goeschel Ndjomouo (cgoesc2@wgu.edu)
+# Description: Delete an a git repository
+
+# -------------------------------------------------------------
+# Global variables
+
+declare -r GIT_DIR="/srv/git"
+declare -x REPO_NAME
+declare -x ERR_MSG
+
+function delete_repo() {
+
+ if [[ ! -d "${GIT_DIR}/${REPO_NAME}" ]]; then
+ ERR_MSG="Repo ${REPO_NAME} doesn't exist"
+ return 1
+ fi
+
+ rm -rf "${GIT_DIR}/${REPO_NAME}" &&
+ if [[ "${?}" != "0" ]]; then
+ ERR_MSG="Could not delete repo '${REPO_NAME}'"
+ return 1
+ fi
+
+ return 0
+}
+
+function main() {
+
+ if [[ -z "${1}" ]]; then
+ echo "The repository name cannot be an empty string!"
+ exit 1
+ fi
+ REPO_NAME="${1}.git"
+
+ delete_repo
+ if [[ "${?}" != "0" ]]; then
+ echo "${ERR_MSG}"
+ exit 1
+ fi
+
+ echo "Successfully deleted repository ${REPO_NAME}"
+
+ exit 0
+}
+
+main ${@}