-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·53 lines (48 loc) · 1.37 KB
/
installer.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
#!/usr/bin/bash
###################################
# CCalc Installer #
###################################
echo "#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
echo "# -- [ CCalc Installer ] -- #"
echo "#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
function prompt_delete_file() {
local file=$1
local choice=1
while true; do
clear
echo "Do you want to delete $file?"
if [ $choice -eq 1 ]; then
echo "> Yes"
echo " No - Recommended"
else
echo " Yes"
echo "> No - Recommended"
fi
read -rsn1 input
case $input in
$'\x1b')
read -rsn2 -t 0.1 input
if [ "$input" == "[A" ]; then
choice=1
elif [ "$input" == "[B" ]; then
choice=2
fi
;;
'')
if [ $choice -eq 1 ]; then
rm -f $file
echo "$file deleted."
sleep 1
return 0
else
echo "$file not deleted."
sleep 1
return 1
fi
;;
esac
done
}
prompt_delete_file "README.md"
prompt_delete_file "ccalc.c"
make