]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
initscripts: readhash: Only strip quotes if they exist
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Dec 2024 16:42:16 +0000 (16:42 +0000)
committerArne Fitzenreiter <arne_f@ipfire.org>
Wed, 18 Dec 2024 07:13:55 +0000 (08:13 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
src/initscripts/system/functions

index 125aa1dc62cf5d1d14dd87bb0f331e2a1ce7ece8..094e3549562c08d94a21507510321f39902c68d5 100644 (file)
@@ -899,7 +899,6 @@ readhash() {
 
        local line
        while read -r line; do
-
                # Skip Blank Lines
                if [[ ${line} =~ ^[[:space:]]*$ ]]; then
                        continue
@@ -932,8 +931,12 @@ readhash() {
                fi
 
                # strip leading and trailing single quotes
-               val="${val#\'}"
-               val="${val%\'}"
+               case "${val}" in
+                       '*')
+                               val="${val#\'}"
+                               val="${val%\'}"
+                               ;;
+               esac
 
                printf -v "${array}[${key}]" "%s" "${val}"
        done < "${file}"