fix(脚本): 修改path的截取

pull/534/merge
mack-a 2020-12-28 11:13:23 +08:00
parent 9bb3556f5f
commit 949028668e
2 changed files with 11 additions and 2 deletions

4
demo.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
str="abcdefg"
echo ${str:0-2:4}

View File

@ -185,10 +185,15 @@ readConfigHostPathUUID(){
local path=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq .inbounds[0].settings.fallbacks|jq -c '.[].path'|awk -F "[\"][/]" '{print $2}'|awk -F "[\"]" '{print $1}'|tail -n +2|head -n 1` local path=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq .inbounds[0].settings.fallbacks|jq -c '.[].path'|awk -F "[\"][/]" '{print $2}'|awk -F "[\"]" '{print $1}'|tail -n +2|head -n 1`
if [[ ! -z "${path}" ]] if [[ ! -z "${path}" ]]
then then
currentPath=${path:0:4} if [[ `echo ${path:0-2}` = "ws" ]]
then
currentPath=`echo ${path}|awk -F "[w][s]" '{print $1}'`
elif [[ `echo ${path:0-2}` = "tcp" ]]
then
currentPath=`echo ${path}|awk -F "[t][c][p]" '{print $1}'`
fi
fi fi
fi fi
if [[ "${coreInstallType}" = "1" ]] if [[ "${coreInstallType}" = "1" ]]
then then
currentHost=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'` currentHost=`cat ${configPath}02_VLESS_TCP_inbounds.json|jq .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`