inifuncs.sh: use basic regular expression match in iniset ?
-
I was wondering what contradicts the usage of basic regular expressions in the
iniset
function [1].This would allow the characters
+()|
to be used as keys (e.g. inemulators.cfg
and in turn for selecting an emulator (represented by that key) in runcommand menu. A specific switch or enabled feature for an emulator could be designated with a+
sign).Currently it is possible to use
+()
aso. but: The beforementioned [1]egrep
fails in detection and in turn a second key-value pair is added to the "ini file" (emulators.cfg
for example) if such key entry exists already:iniset
performs an add instead of an update.I have run a few tests with this change and it works okay:
diff --git a/scriptmodules/inifuncs.sh b/scriptmodules/inifuncs.sh index dea846fc..8d407e0b 100644 --- a/scriptmodules/inifuncs.sh +++ b/scriptmodules/inifuncs.sh @@ -63,7 +63,7 @@ function iniProcess() { local match if [[ -f "$file" ]]; then - match=$(egrep -i "$match_re" "$file" | tail -1) + match=$(grep -i "$match_re" "$file" | tail -1) else touch "$file" fi
By reviewing the iniset usage where a variable is used as key (and not a static text) I could not identify a regression with this change.
Is this change useful to put upstream?
-
@lolonois I'll have to look into this to remind myself, but don't have much time at the moment. But feel free to open a PR and we can discuss.
-
Sure, no need for a hurry.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.