Skip to content

Commit

Permalink
Update install.ubuntu.18.04.sh (#120)
Browse files Browse the repository at this point in the history
* Update install.ubuntu.18.04.sh

上一个 pr 漏了一个地方

修复:

添加了括号调整运算符优先级,修复对端口号的校验
修改端口号上限为 65535

* Update install.ubuntu.18.04.sh
  • Loading branch information
codepiano committed Apr 18, 2023
1 parent 53ccdbd commit f692fce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/install.ubuntu.18.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ install_gost() {
read -r -p "请输入你要使用的密码:" PASS
read -r -p "请输入HTTP/2需要侦听的端口号(443):" PORT

if [[ -z "${PORT// }" ]] || ! [[ "${PORT}" =~ ^[0-9]+$ ]] || ! [ "$PORT" -ge 1 ] && [ "$PORT" -le 655535 ]; then
if [[ -z "${PORT// }" ]] || ! [[ "${PORT}" =~ ^[0-9]+$ ]] || ! { [ "$PORT" -ge 1 ] && [ "$PORT" -le 65535 ]; }; then
echo -e "${COLOR_ERROR}非法端口,使用默认端口 443 !${COLOR_NONE}"
PORT=443
fi
Expand Down Expand Up @@ -177,7 +177,7 @@ install_shadowsocks(){

BIND_IP=0.0.0.0

if [[ -z "${PORT// }" ]] || ! [[ "${PORT}" =~ ^[0-9]+$ ]] || ! ([ "$PORT" -ge 1 ] && [ "$PORT" -le 65535 ]); then
if [[ -z "${PORT// }" ]] || ! [[ "${PORT}" =~ ^[0-9]+$ ]] || ! { [ "$PORT" -ge 1 ] && [ "$PORT" -le 65535 ]; }; then
echo -e "${COLOR_ERROR}非法端口,使用默认端口 1984 !${COLOR_NONE}"
PORT=1984
fi
Expand Down

0 comments on commit f692fce

Please sign in to comment.