blob: 1402bae46ddcd64f5df9263e7b0873d1c9ae04c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/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 "Confirm delete? [y/N] "
read -r confirm
if [ "${confirm,,}" = "y" ]; then
rm -rf "${base_dir:?}/${target:?}" \
&& echo "Deleted Git repository ${target}"
fi
else
echo "$target does not exist."
fi
|