File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,15 @@ install_docker() {
65
65
fi
66
66
}
67
67
68
+
68
69
check_container (){
69
70
has_container=$( sudo docker ps --format " {{.Names}}" | grep " $1 " )
70
71
72
+ # test 命令规范: 0 为 true, 1 为 false, >1 为 error
71
73
if [ -n " $has_container " ] ; then
72
- return 1
73
- else
74
74
return 0
75
+ else
76
+ return 1
75
77
fi
76
78
}
77
79
@@ -110,7 +112,7 @@ install_gost() {
110
112
return
111
113
fi
112
114
113
- if [ 1 = " $( check_container gost) " ] ; then
115
+ if check_container gost ; then
114
116
echo -e " ${COLOR_ERROR} Gost 容器已经在运行了,你可以手动停止容器,并删除容器,然后再执行本命令来重新安装 Gost。 ${COLOR_NONE} "
115
117
return
116
118
fi
@@ -164,7 +166,7 @@ install_shadowsocks(){
164
166
return
165
167
fi
166
168
167
- if [ 1 = " $( check_container ss) " ] ; then
169
+ if [ check_container ss ; then
168
170
echo -e " ${COLOR_ERROR} ShadowSocks 容器已经在运行了,你可以手动停止容器,并删除容器,然后再执行本命令来重新安装 ShadowSocks。${COLOR_NONE} "
169
171
return
170
172
fi
@@ -191,7 +193,7 @@ install_vpn(){
191
193
return
192
194
fi
193
195
194
- if [ 1 = " $( check_container vpn) " ] ; then
196
+ if check_container vpn ; then
195
197
echo -e " ${COLOR_ERROR} VPN 容器已经在运行了,你可以手动停止容器,并删除容器,然后再执行本命令来重新安装 VPN。${COLOR_NONE} "
196
198
return
197
199
fi
You can’t perform that action at this time.
0 commit comments