diff --git a/bin/update_uuid.sh b/bin/update_uuid.sh index f993147..d7adf5f 100644 --- a/bin/update_uuid.sh +++ b/bin/update_uuid.sh @@ -1,16 +1,16 @@ #!/bin/bash -script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 -config_dir="$script_dir/../conf" +SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 +CONFIG_DIR="$SCRIPT_DIR/../conf" # 生成 UUID -uuid=$(xray uuid) +UUID=$(xray uuid) # 使用 jq 修改 JSON 文件 -jq ".inbounds[0].settings.clients[0].id=\"$uuid\"" $config_dir/config.json > $config_dir/config.json_tmp +jq ".inbounds[0].settings.clients[0].id=\"$UUID\"" $CONFIG_DIR/config.json > $CONFIG_DIR/config.json_tmp # 替换原始文件 -mv $config_dir/config.json_tmp $config_dir/config.json +mv $CONFIG_DIR/config.json_tmp $CONFIG_DIR/config.json # 验证结果 echo "设置UUID成功."