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} }