~拆分脚本,大幅度优化结构

This commit is contained in:
juewuy
2025-12-21 22:11:05 +08:00
parent 1ed156f724
commit bf55553d63
18 changed files with 4922 additions and 3663 deletions

View File

@@ -1,17 +1,17 @@
#!/bin/sh
# Copyright (C) Juewuy
if [ $1 -gt 65535 -o $1 -le 1 ]; then
echo -e "\033[31m输入错误请输入正确的数值(1-65535)\033[0m"
exit 1
elif [ -n "$(echo "|$mix_port|$redir_port|$dns_port|$db_port|" | grep "|$1|")" ]; then
echo -e "\033[31m输入错误请不要输入重复的端口\033[0m"
exit 1
elif [ -n "$(netstat -ntul | grep ":$1 ")" ]; then
echo -e "\033[31m当前端口已被其他进程占用请重新输入\033[0m"
exit 1
else
exit 0
fi
check_port(){
if [ "$1" -gt 65535 -o "$1" -le 1 ]; then
echo -e "\033[31m输入错误请输入正确的数值(1-65535)\033[0m"
return 1
elif [ -n "$(echo "|$mix_port|$redir_port|$dns_port|$db_port|" | grep "|$1|")" ]; then
echo -e "\033[31m输入错误请不要输入重复的端口\033[0m"
return 1
elif [ -n "$(netstat -ntul | grep ":$1 ")" ]; then
echo -e "\033[31m当前端口已被其他进程占用请重新输入\033[0m"
return 1
else
return 0
fi
}