From b887abc50a67afb7d831335a572ad8050d09df5e Mon Sep 17 00:00:00 2001 From: Kiolow Date: Fri, 7 Jun 2024 13:08:00 +0800 Subject: [PATCH] fix bug --- bin/utils/jq_util.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/utils/jq_util.sh b/bin/utils/jq_util.sh index 35f7703..64dfc01 100644 --- a/bin/utils/jq_util.sh +++ b/bin/utils/jq_util.sh @@ -7,6 +7,11 @@ function modify_json_file() { local key=$2 # 要修改的key local value=$3 # 要修改的value + #如果key的值是.开头, 则去掉.号 + if [[ ${key} == "."* ]]; then + key=${key:1} + fi + jq ".${key} = \"${value}\"" ${json_file} > ${json_file}.tmp mv ${json_file}.tmp ${json_file} }