Skip to content

Commit 3018a21

Browse files
committed
[fix] all the .sh file execute by bash.
fix Echo_color problem.
1 parent b89a263 commit 3018a21

File tree

8 files changed

+84
-74
lines changed

8 files changed

+84
-74
lines changed

.DS_Store

8 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test*

all_setup.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#!/usr/bin/env bash
22

33
function Echo_Color(){
4-
case $1 in
5-
r* | R* )
6-
COLOR='\e[31m'
7-
;;
8-
g* | G* )
9-
COLOR='\e[32m'
10-
;;
11-
y* | Y* )
12-
COLOR='\e[33m'
13-
;;
14-
b* | B* )
15-
COLOR='\e[34m'
16-
;;
17-
*)
18-
echo "$COLOR Wrong COLOR keyword!\e[0m"
19-
;;
4+
case $1 in
5+
r* | R* )
6+
COLOR='\033[0;31m'
7+
;;
8+
g* | G* )
9+
COLOR='\033[0;32m'
10+
;;
11+
y* | Y* )
12+
COLOR='\033[0;33m'
13+
;;
14+
b* | B* )
15+
COLOR='\033[0;34m'
16+
;;
17+
*)
18+
echo "$COLOR Wrong COLOR keyword!\033[0m"
19+
;;
2020
esac
21-
echo -e "$COLOR$2\e[0m"
22-
}
21+
echo -e "$COLOR$2\033[0m"
22+
}
23+
2324

2425

2526
all_accept=-y

application.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ fi
4949
function Echo_Color(){
5050
case $1 in
5151
r* | R* )
52-
COLOR='\e[31m'
52+
COLOR='\033[0;31m'
5353
;;
5454
g* | G* )
55-
COLOR='\e[32m'
55+
COLOR='\033[0;32m'
5656
;;
5757
y* | Y* )
58-
COLOR='\e[33m'
58+
COLOR='\033[0;33m'
5959
;;
6060
b* | B* )
61-
COLOR='\e[34m'
61+
COLOR='\033[0;34m'
6262
;;
6363
*)
64-
echo "$COLOR Wrong COLOR keyword!\e[0m"
64+
echo "$COLOR Wrong COLOR keyword!\033[0m"
6565
;;
66-
esac
67-
echo -e "$COLOR$2\e[0m"
68-
}
66+
esac
67+
echo -e "$COLOR$2\033[0m"
68+
}
6969

7070
function Ask_yn(){
71-
printf "\e[33m$1\e[0m\e[33m [y/n] \e[0m"
71+
printf "\033[0;33m$1\033[0m\033[0;33m [y/n] \033[0m"
7272
if [ $all_accept = 1 ]; then
7373
echo '-y'
7474
return 1

custom_function.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,26 @@ declare -A funcs_info=([nvm]=$no_nvm [pipenv_correspond]=$no_pipenv_correspond)
6868
function Echo_Color(){
6969
case $1 in
7070
r* | R* )
71-
COLOR='\e[31m'
71+
COLOR='\033[0;31m'
7272
;;
7373
g* | G* )
74-
COLOR='\e[32m'
74+
COLOR='\033[0;32m'
7575
;;
7676
y* | Y* )
77-
COLOR='\e[33m'
77+
COLOR='\033[0;33m'
7878
;;
7979
b* | B* )
80-
COLOR='\e[34m'
80+
COLOR='\033[0;34m'
8181
;;
8282
*)
83-
echo "$COLOR Wrong COLOR keyword!\e[0m"
83+
echo "$COLOR Wrong COLOR keyword!\033[0m"
8484
;;
85-
esac
86-
echo -e "$COLOR$2\e[0m"
87-
}
85+
esac
86+
echo -e "$COLOR$2\033[0m"
87+
}
8888

8989
function Ask_yn(){
90-
printf "\e[33m$1\e[0m\e[33m [y/n] \e[0m"
90+
printf "\033[0;33m$1\033[0m\033[0;33m [y/n] \033[0m"
9191
if [ $all_accept = 1 ]; then
9292
echo '-y'
9393
return 1

language_package.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,26 @@ fi
5353
function Echo_Color(){
5454
case $1 in
5555
r* | R* )
56-
COLOR='\e[31m'
56+
COLOR='\033[0;31m'
5757
;;
5858
g* | G* )
59-
COLOR='\e[32m'
59+
COLOR='\033[0;32m'
6060
;;
6161
y* | Y* )
62-
COLOR='\e[33m'
62+
COLOR='\033[0;33m'
6363
;;
6464
b* | B* )
65-
COLOR='\e[34m'
65+
COLOR='\033[0;34m'
6666
;;
6767
*)
68-
echo "$COLOR Wrong COLOR keyword!\e[0m"
68+
echo "$COLOR Wrong COLOR keyword!\033[0m"
6969
;;
70-
esac
71-
echo -e "$COLOR$2\e[0m"
72-
}
70+
esac
71+
echo -e "$COLOR$2\033[0m"
72+
}
7373

7474
function Ask_yn(){
75-
printf "\e[33m$1\e[0m\e[33m [y/n] \e[0m"
75+
printf "\033[0;33m$1\033[0m\033[0;33m [y/n] \033[0m"
7676
if [ $all_accept = 1 ]; then
7777
echo '-y'
7878
return 1

package.sh

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#- -h, --help print help information.
1414
#- -no_git-config do not customize git.
1515
#- -no_vim-config do not use customize .vimrc config file (from ./config/.vimrc).
16+
#- -no_tmux-config do not use customize .tmux.conf file (from ./config/.tmux.conf).
1617
#- -no_chewing do not install Taiwanese typing method.
1718
#- -no_extra-packages do not install all the extra-packages.
1819
#-
1920
#- =========== extra package options ===========
2021
#- --no_ssh-server do not install openssh-server.
21-
#- --no_screen do not install screen.
2222
#- --no_pip3 do not install python3-pip.
2323
#-
2424
#- EXAMPLES
@@ -42,10 +42,10 @@ function show_script_help(){
4242
all_accept=0
4343
git_config=1
4444
vim_config=1
45+
tmux_config=1
4546
chewing=1
4647
extra_packages=1
4748
ssh_server=1
48-
screen=1
4949
pip3=1
5050
if [ "$#" -gt 0 ]; then
5151
while [ "$#" -gt 0 ]; do
@@ -70,6 +70,11 @@ if [ "$#" -gt 0 ]; then
7070
vim_config=0
7171
shift 1
7272
;;
73+
# Not use customize .tmux.conf file (from ./config/.tmux.conf).
74+
"-no_tmux-config" )
75+
tmux_config=0
76+
shift 1
77+
;;
7378
# Not install Taiwanese typing method
7479
"-no_chewing" )
7580
chewing=0
@@ -85,11 +90,6 @@ if [ "$#" -gt 0 ]; then
8590
ssh_server=0
8691
shift 1
8792
;;
88-
# Not install screen
89-
"--no_screen" )
90-
screen=0
91-
shift 1
92-
;;
9393
# Not install python3-pip
9494
"--no_pip3" )
9595
pip3=0
@@ -102,31 +102,31 @@ if [ "$#" -gt 0 ]; then
102102
done
103103
fi
104104
declare -A Extra_package_dict
105-
Extra_package_dict=([openssh-server]=$ssh_server [screen]=$screen [python3-pip]=$pip3)
105+
Extra_package_dict=([openssh-server]=$ssh_server [python3-pip]=$pip3)
106106

107107
function Echo_Color(){
108108
case $1 in
109109
r* | R* )
110-
COLOR='\e[31m'
110+
COLOR='\033[0;31m'
111111
;;
112112
g* | G* )
113-
COLOR='\e[32m'
113+
COLOR='\033[0;32m'
114114
;;
115115
y* | Y* )
116-
COLOR='\e[33m'
116+
COLOR='\033[0;33m'
117117
;;
118118
b* | B* )
119-
COLOR='\e[34m'
119+
COLOR='\033[0;34m'
120120
;;
121121
*)
122-
echo "$COLOR Wrong COLOR keyword!\e[0m"
122+
echo "$COLOR Wrong COLOR keyword!\033[0m"
123123
;;
124-
esac
125-
echo -e "$COLOR$2\e[0m"
126-
}
124+
esac
125+
echo -e "$COLOR$2\033[0m"
126+
}
127127

128128
function Ask_yn(){
129-
printf "\e[33m$1\e[0m\e[33m [y/n] \e[0m"
129+
printf "\033[0;33m$1\033[0m\033[0;33m [y/n] \033[0m"
130130
if [ $all_accept = 1 ]; then
131131
echo '-y'
132132
return 1
@@ -149,7 +149,7 @@ function Ask_yn(){
149149
#====================================================
150150
sudo apt update
151151
sudo apt upgrade
152-
sudo apt install -y git-all vim curl wget make
152+
sudo apt install -y git-all vim curl wget make tmux
153153

154154
if [ $git_config = 1 ]; then
155155
# git: config global usr information
@@ -209,10 +209,18 @@ if [ $git_config = 1 ]; then
209209
fi
210210

211211
if [ $vim_config = 1 ]; then
212-
Ask_yn "Do you want to use customize VIM editor setting? $(Echo_Color r '(If you do this, the old ~/.vimrc will remove it.)')"; result=$?
212+
Ask_yn "Do you want to use customized VIM editor setting? $(Echo_Color r '(If you do this, the old ~/.vimrc will remove it.)')"; result=$?
213213
if [ $result = 1 ]; then
214214
cp ./config/.vimrc ~/
215-
Echo_Color g "Completed VIM editor customize setting"
215+
Echo_Color g "Completed VIM editor customized setting"
216+
fi
217+
fi
218+
219+
if [ $tmux_config = 1 ]; then
220+
Ask_yn "Do you want to use customized tmux configuration? $(Echo_Color r '(If you do this, the old ~/.tmux.conf will remove it.)')"; result=$?
221+
if [ $result = 1 ]; then
222+
cp ./config/.tmux.conf ~/
223+
Echo_Color g "Completed customized tmux configuration"
216224
fi
217225
fi
218226

terminal_config.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ fi
4949
function Echo_Color(){
5050
case $1 in
5151
r* | R* )
52-
COLOR='\e[31m'
52+
COLOR='\033[0;31m'
5353
;;
5454
g* | G* )
55-
COLOR='\e[32m'
55+
COLOR='\033[0;32m'
5656
;;
5757
y* | Y* )
58-
COLOR='\e[33m'
58+
COLOR='\033[0;33m'
5959
;;
6060
b* | B* )
61-
COLOR='\e[34m'
61+
COLOR='\033[0;34m'
6262
;;
6363
*)
64-
echo "$COLOR Wrong COLOR keyword!\e[0m"
64+
echo "$COLOR Wrong COLOR keyword!\033[0m"
6565
;;
66-
esac
67-
echo -e "$COLOR$2\e[0m"
68-
}
66+
esac
67+
echo -e "$COLOR$2\033[0m"
68+
}
6969

7070
function Ask_yn(){
71-
printf "\e[33m$1\e[0m\e[33m [y/n] \e[0m"
71+
printf "\033[0;33m$1\033[0m\033[0;33m [y/n] \033[0m"
7272
if [ $all_accept = 1 ]; then
7373
echo '-y'
7474
return 1

0 commit comments

Comments
 (0)