From 05fc13bc1d8901bf60febb650d29341b6953c7f7 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 10 Aug 2019 00:04:21 +0100 Subject: [PATCH] Escape any 's in the key name. --- parse-ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parse-ini b/parse-ini index df2f656..f2b1924 100755 --- a/parse-ini +++ b/parse-ini @@ -469,6 +469,9 @@ parse_ini() { # Squash multiple consecutive blanks into a single space. ((SQUASH_SPACES == 1)) && KEY="${KEY//+([[:blank:]])/ }" + # Escape any 's in the key name. + KEY="${KEY//\'/\'\\\'\'}" + # If the value starts with a " or ' it must end with same. if [[ "${VALUE:0:1}" =~ [\"\'] ]]; then if [[ "${VALUE:0:1}" == "${VALUE: -1:1}" ]]; then