-
Notifications
You must be signed in to change notification settings - Fork 1
/
clean.sh
57 lines (47 loc) · 1.23 KB
/
clean.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
clearLuaFiles() {
luaFiles=$(./listFiles.sh lua)
if [ -n "$luaFiles" ]; then
echo "Cleanning .lua files from /lua..."
rm -f -r -d $luaFiles
return $?
else
echo "Folder /lua is already cleared"
fi
return 1
}
clearBinFiles() {
binFiles=$(./listFiles.sh bin)
if [ -n "$binFiles" ]; then
echo "Cleanning bin files from /bin..."
rm -f -r -d $binFiles
return $?
else
echo "Folder /bin is already cleared"
fi
return 1
}
cleanningsExecuted=0
if [ -n "$1" ] && [ "$1" = "lua" ]; then
clearLuaFiles
if [ "$?" -eq "0" ]; then
cleanningsExecuted=$(( cleanningsExecuted + 1 ))
fi
elif [ -n "$1" ] && [ "$1" = "bin" ]; then
clearBinFiles
if [ "$?" -eq "0" ]; then
cleanningsExecuted=$(( cleanningsExecuted + 1 ))
fi
elif [ -n "$1" ] && [ "$1" = "all" ]; then
clearLuaFiles
if [ "$?" -eq "0" ]; then
cleanningsExecuted=$(( cleanningsExecuted + 1 ))
fi
clearBinFiles
if [ "$?" -eq "0" ]; then
cleanningsExecuted=$(( cleanningsExecuted + 1 ))
fi
fi
if [ "$cleanningsExecuted" -gt "0" ]; then
echo "Done!"
fi