Skip to content

Commit 7786cd2

Browse files
authored
Merge pull request #702 from wfleurant/fix/ini-envsubst-safe-expansion
ini: use envsubst
2 parents d98deae + 494b191 commit 7786cd2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/config/src/lib/ini.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ini_load() {
4747
elif [[ $line =~ $key_regex ]]; then
4848
key="${BASH_REMATCH[1]}"
4949
value="${BASH_REMATCH[2]}"
50-
[[ $value == *\$* ]] && eval "value=\"$value\""
50+
[[ $value == *\$* ]] && value=$(envsubst <<<"$value")
5151
ini["${section}${key}"]="$value"
5252
fi
5353
done <"$ini_file"

examples/ini/src/lib/ini.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ini_load() {
4747
elif [[ $line =~ $key_regex ]]; then
4848
key="${BASH_REMATCH[1]}"
4949
value="${BASH_REMATCH[2]}"
50-
[[ $value == *\$* ]] && eval "value=\"$value\""
50+
[[ $value == *\$* ]] && value=$(envsubst <<<"$value")
5151
ini["${section}${key}"]="$value"
5252
fi
5353
done <"$ini_file"

lib/bashly/libraries/ini/ini.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ini_load() {
4747
elif [[ $line =~ $key_regex ]]; then
4848
key="${BASH_REMATCH[1]}"
4949
value="${BASH_REMATCH[2]}"
50-
[[ $value == *\$* ]] && eval "value=\"$value\""
50+
[[ $value == *\$* ]] && value=$(envsubst <<<"$value")
5151
ini["${section}${key}"]="$value"
5252
fi
5353
done <"$ini_file"

0 commit comments

Comments
 (0)