bash_ini_parser icon indicating copy to clipboard operation
bash_ini_parser copied to clipboard

Problem with the characters ' in value of variables

Open indelog opened this issue 6 years ago • 0 comments

The substitution for the escape of ' not work.

I propose this correction :

diff --git a/read_ini.sh b/read_ini.sh
index 06b1bc8..2ae2a85 100755
--- a/read_ini.sh
+++ b/read_ini.sh
@@ -270,7 +270,7 @@ function read_ini()
                # enclose the value in single quotes and escape any
                # single quotes and backslashes that may be in the value
                VAL="${VAL//\\/\\\\}"
-               VAL="\$'${VAL/\'/\\\'}'"
+               VAL="\$'${VAL//\'/\'}'"
 
                eval "$VARNAME=$VAL"
        done  <"${INI_FILE}"

indelog avatar May 16 '18 16:05 indelog