summaryrefslogtreecommitdiff
path: root/rm
diff options
context:
space:
mode:
Diffstat (limited to 'rm')
-rwxr-xr-xrm26
1 files changed, 26 insertions, 0 deletions
diff --git a/rm b/rm
new file mode 100755
index 0000000..0c1ee10
--- /dev/null
+++ b/rm
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "usage: rm <name>"
+ exit 1
+fi
+
+base_dir="$HOME"
+target="$1"
+
+case $target in
+ *\.git)
+ ;;
+ *)
+ target="${target}.git"
+ ;;
+esac
+
+if [ -d "$target" ]; then
+ printf "Really delete? [y/N] "
+ read -r confirm
+ if [ "${confirm,,}" = "y" ]; then
+ rm -rf "${base_dir:?}/${target:?}" \
+ && echo "${target} deleted"
+ fi
+fi