Fix long standing get_settings bug that does not honor filenames with a single quote.

This commit is contained in:
fewtarius 2023-12-29 17:55:37 +00:00
parent 7d4b58ab25
commit b559146951
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A

View file

@ -30,7 +30,7 @@ function get_setting() {
if [ -n "${3}" ]
then
### Test to see if we have a game setting.
VAR="$2\[\"$(echo ${3} | sed 's/\W/\\&/g')\"]\.$1"
VAR="$2\[\"$(echo ${3} | sed -E "s~'~\\\x27~g"';s~[()&]~\\&~g')\"\]\.$1"
OUTPUT=$(awk 'BEGIN {FS="="} /^'"${VAR}"'/ {print $NF}' ${J_CONF})
if [ ! -z "${OUTPUT}" ]
then