From 31ef9bb9b8f0f8ac01d314a42c4d3170dd8febf5 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Thu, 31 Dec 2020 10:51:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=BB=8F=E8=BF=87=E5=A4=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=85=8D=E7=BD=AE=E6=93=8D=E4=BD=9C=E5=90=8E?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=88=B0=E4=B8=80=E8=A1=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7=E8=BE=83=E5=B7=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 3679682..2e364f0 100644 --- a/install.sh +++ b/install.sh @@ -2563,6 +2563,7 @@ addUser(){ if [[ -z ${userNum} || ${userNum} -le 0 ]] then echoContent red " ---> 输入有误,请重新输入" + exit fi # 生成用户 @@ -2616,29 +2617,34 @@ addUser(){ if [[ ! -z `echo ${currentInstallProtocolType} | grep 0` ]] then - echo `cat ${configPath}02_VLESS_TCP_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` > ${configPath}02_VLESS_TCP_inbounds.json + local vlessTcpResult=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` + echo ${vlessTcpResult} | jq . > ${configPath}02_VLESS_TCP_inbounds.json fi users=`echo ${users}|sed 's/"flow":"xtls-rprx-direct",//g'` if [[ ! -z `echo ${currentInstallProtocolType} | grep 1` ]] then - echo `cat ${configPath}03_VLESS_WS_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` > ${configPath}03_VLESS_WS_inbounds.json + local vlessWsResult=`cat ${configPath}03_VLESS_WS_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` + echo ${vlessWsResult}|jq . > ${configPath}03_VLESS_WS_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType}|grep 2` ]] then - echo `cat ${configPath}04_VMess_TCP_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` > ${configPath}04_VMess_TCP_inbounds.json + local vmessTcpResult=`cat ${configPath}04_VMess_TCP_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` + echo ${vmessTcpResult}|jq . > ${configPath}04_VMess_TCP_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType} | grep 3` ]] then - echo `cat ${configPath}05_VMess_WS_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` > ${configPath}05_VMess_WS_inbounds.json + local vmessWsResult=`cat ${configPath}05_VMess_WS_inbounds.json|jq -r '.inbounds[0].settings.clients += ['${users}']'` + echo ${vmessWsResult}|jq . > ${configPath}05_VMess_WS_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType} | grep 4` ]] then - echo `cat ${configPath}../../trojan/config_full.json|jq -r '.password += ['${trojanGoUsers}']'` > ${configPath}../../trojan/config_full.json + local trojanResult=`cat ${configPath}../../trojan/config_full.json|jq -r '.password += ['${trojanGoUsers}']'` + echo ${trojanResult}|jq . > ${configPath}../../trojan/config_full.json handleTrojanGo stop handleTrojanGo start fi @@ -2668,29 +2674,34 @@ removeUser(){ echoContent red " ---> 选择错误" else delUserIndex=`expr ${delUserIndex} - 1` - echo `cat ${configPath}02_VLESS_TCP_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` > ${configPath}02_VLESS_TCP_inbounds.json + local vlessTcpResult=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` + echo ${vlessTcpResult}|jq . > ${configPath}02_VLESS_TCP_inbounds.json fi fi if [[ ! -z "${delUserIndex}" ]] then if [[ ! -z `echo ${currentInstallProtocolType} | grep 1` ]] then - echo `cat ${configPath}03_VLESS_WS_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` > ${configPath}03_VLESS_WS_inbounds.json + local vlessTcpResult=`cat ${configPath}03_VLESS_WS_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` + echo ${vlessTcpResult}|jq . > ${configPath}03_VLESS_WS_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType}|grep 2` ]] then - echo `cat ${configPath}04_VMess_TCP_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` > ${configPath}04_VMess_TCP_inbounds.json + local vlessTcpResult=`cat ${configPath}04_VMess_TCP_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` + echo ${vlessTcpResult}|jq . > ${configPath}04_VMess_TCP_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType} | grep 3` ]] then - echo `cat ${configPath}05_VMess_WS_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` > ${configPath}05_VMess_WS_inbounds.json + local vlessTcpResult=`cat ${configPath}05_VMess_WS_inbounds.json|jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])'` + echo ${vlessTcpResult}|jq . > ${configPath}05_VMess_WS_inbounds.json fi if [[ ! -z `echo ${currentInstallProtocolType} | grep 4` ]] then - echo `cat ${configPath}../../trojan/config_full.json|jq -r 'del(.password['${delUserIndex}'])'` > ${configPath}../../trojan/config_full.json + local trojanResult=`cat ${configPath}../../trojan/config_full.json|jq -r 'del(.password['${delUserIndex}'])'` + echo ${trojanResult}|jq . > ${configPath}../../trojan/config_full.json handleTrojanGo stop handleTrojanGo start fi @@ -3222,7 +3233,7 @@ menu(){ cd echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.2.11" + echoContent green "当前版本:v2.2.12" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:七合一共存脚本" echoContent red "=============================================================="