From fd7dccee73bfe4e810fbd91e93e6e3a3b80be8ad Mon Sep 17 00:00:00 2001 From: H3o66 Date: Tue, 21 Sep 2021 21:32:49 +0200 Subject: [PATCH] fix(cod4): Improve servername and rcon password parsing --- lgsm/functions/info_game.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/info_game.sh b/lgsm/functions/info_game.sh index 5f460c68e..9550ed767 100644 --- a/lgsm/functions/info_game.sh +++ b/lgsm/functions/info_game.sh @@ -310,8 +310,8 @@ fn_info_game_cod4(){ servername="${unavailable}" rconpassword="${unavailable}" else - servername=$(grep "sv_hostname " "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | xargs) - rconpassword=$(grep "rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + servername=$(sed -nr 's/^set\s*sv_hostname\s*"(.*)".*/\1/p' "${servercfgfullpath}") + rconpassword=$(sed -nr 's/^set\s*rcon_password\s*"(.*)"\s*\/.*/\1/p' "${servercfgfullpath}") # Not Set servername=${servername:-"NOT SET"}