Update 19-json_repair.sh

This commit is contained in:
Alexandre
2021-10-31 17:20:30 +01:00
committed by GitHub
parent d7326e9aab
commit 07e2d9d3ff

View File

@@ -26,7 +26,7 @@ if [ -f ${JSONTOCHECK} ]; then
KEYSTHERE=$(jq "has(\"${KEYS}\")" ${JSONTOCHECK})
if [ $KEYSTHERE != "true" ]; then
#Fetch initial value
JSONSOURCEVALUE=$(jq -r .${KEYS} ${JSONSOURCE})
JSONSOURCEVALUE=$(jq -r ".\"$KEYS\"" ${JSONSOURCE})
#Add key
sed -i "3 i\"${KEYS}\": \"${JSONSOURCEVALUE}\"}," ${JSONTOCHECK}
# Message