-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
82 lines (75 loc) · 1.99 KB
/
config.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
# vim: foldmethod=marker
# Linux or BSD?
OS_TYPE=$(uname -o)
# Current working directory
if [[ -n $1 ]]; then
WORKING_DIR="$1"
else
WORKING_DIR="${PWD}"
fi
# Colorize
printf "1. %s\n2. %s\n" "Enable Colorize" "Disable Colorize"
read -p ">>> " COLORIZE_YES_NO
# Case statements for Colorize
case "${COLORIZE_YES_NO}" in
[Ee][Nn][Aa][Bb][Ll][Ee]|1)
case "${OS_TYPE}" in
*[Gg][Nn][Uu]/[Ll][Ii][Nn][Uu][Xx]*)
sed -i "s,COLORIZE=\"false\",COLORIZE=\"true\", " ${WORKING_DIR}/dumBash.sh
;;
*[Ff][Rr][Ee][Bb][Ss][Dd]*)
sed -i "" "s,COLORIZE=\"false\",COLORIZE=\"true\", " ${WORKING_DIR}/dumBash.sh
;;
esac
;;
[Dd][Ii][Ss][Aa][Bb][Ll][Ee]|2)
case "${OS_TYPE}" in
*[Gg][Nn][Uu]/[Ll][Ii][Nn][Uu][Xx]*)
sed -i "s,COLORIZE=\"true\",COLORIZE=\"false\", " ${WORKING_DIR}/dumBash.sh
;;
*[Ff][Rr][Ee][Bb][Ss][Dd]*)
sed -i "" "s,COLORIZE=\"true\",COLORIZE=\"false\", " ${WORKING_DIR}/dumBash.sh
;;
esac
;;
*)
printf "Failed.\n"
exit 1
;;
esac
# Ask Replace
printf "1. %s\n2. %s\n" "Enable Ask Replace" "Disable Ask Replace"
read -p ">>> " ASK_REPLACE_YES_NO
# Case statements for Ask Replace
case "${ASK_REPLACE_YES_NO}" in
[Ee][Nn][Aa][Bb][Ll][Ee]|1)
case "${OS_TYPE}" in
*[Gg][Nn][Uu]/[Ll][Ii][Nn][Uu][Xx]*)
sed -i "s,ASK_REPLACE=\"false\",ASK_REPLACE=\"true\", " ${WORKING_DIR}/dumBash.sh
exit 0
;;
*[Ff][Rr][Ee][Bb][Ss][Dd]*)
sed -i "" "s,ASK_REPLACE=\"false\",ASK_REPLACE=\"true\", " ${WORKING_DIR}/dumBash.sh
exit 0
;;
esac
;;
[Dd][Ii][Ss][Aa][Bb][Ll][Ee]|2)
case "${OS_TYPE}" in
*[Gg][Nn][Uu]/[Ll][Ii][Nn][Uu][Xx]*)
sed -i "s,ASK_REPLACE=\"true\",ASK_REPLACE=\"false\", " ${WORKING_DIR}/dumBash.sh
exit 0
;;
*[Ff][Rr][Ee][Bb][Ss][Dd]*)
sed -i "" "s,ASK_REPLACE=\"true\",ASK_REPLACE=\"false\", " ${WORKING_DIR}/dumBash.sh
exit 0
;;
esac
;;
*)
printf "Failed.\n"
exit 1
;;
esac
unset OS_TYPE COLORIZE_YES_NO ASK_REPLACE_YES_NO WORKING_DIR