rudimeier / bash_ini_parser

simple INI file parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with the characters ' in value of variables

indelog opened this issue · 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}"