-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall.sh
executable file
·38 lines (33 loc) · 1.01 KB
/
uninstall.sh
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
29
30
31
32
33
34
35
36
37
#!/bin/bash
if [ ! -d "$1" ]; then
printf "Directory does not exists: $1"
exit 1
fi
declare -a array=()
# =============================================================== #
# Get files from the directory
# =============================================================== #
BASEDIR=$(pwd)
for entry in "$BASEDIR"/Gogh/themes/*
do
if [ ! $entry == "$BASEDIR/Gogh/themes/README.md" ]; then
array+=("$entry")
fi
done
# =============================================================== #
# Read each file
# =============================================================== #
for element in "${array[@]}"
do
new_theme_file="${element/.sh/.json}"
theme_file_to_be_removed="$1/$(basename $new_theme_file)"
if [ -f "$theme_file_to_be_removed" ]
then
rm $theme_file_to_be_removed
wait
fi
done
# =============================================================== #
# hopefully everything went smooth
# =============================================================== #
printf "Successfully removed themes from : $1"