migrate.sh: fix parsing lines with trailing comments containing special chars

This commit is contained in:
Chris Renshaw
2024-10-21 21:42:15 -03:00
committed by GitHub
parent 7233c66f8a
commit bc591c5732

View File

@@ -15,7 +15,7 @@ die() { [ "$INSTALL" ] || echo "$N$N! $@"; exit 1; }
grep_get_json() {
local target="$FILE";
[ -n "$2" ] && target="$2";
eval set -- "$(cat "$target" | tr -d '\r\n' | grep -m1 -o "$1"'".*' | cut -d: -f2-)";
eval set -- "$(cat "$target" | tr -d '\r\n' | grep -m1 -o "$1"'".*' | cut -d: -f2- | sed 's|//|#|g')";
echo "$1" | sed -e 's|"|\\\\\\"|g' -e 's|[,}]*$||';
}
grep_check_json() {