Browse Source

fix: improve sed command in fn_info_game_valve_keyvalues (#4300)

The sed command in the fn_info_game_valve_keyvalues function has been modified to improve its functionality. The change ensures that only the value between double quotes is captured, even if there are additional spaces before or after the value. This enhances the accuracy of extracting values from server configuration files.
Daniel Gibbs 2 năm trước cách đây
mục cha
commit
6b9393f949
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      lgsm/modules/info_game.sh

+ 1 - 1
lgsm/modules/info_game.sh

@@ -157,7 +157,7 @@ fn_info_game_valve_keyvalues() {
 	else
 	else
 		servercfgparse="${servercfgfullpath}"
 		servercfgparse="${servercfgfullpath}"
 	fi
 	fi
-	eval "${1}=\"$(sed -n '/^\<'"${2}"'\>/ { s/.*  *"\?\([^"]*\)"\?/\1/p;q }' "${servercfgparse}" | tr -d '\r')\""
+	eval "${1}=\"$(sed -n '/^\<'"${2}"'\>/ { s/.*  *"\([^"]*\)".*/\1/p;q }' "${servercfgparse}" | tr -d '\r')\""
 	configtype="valve_keyvalues"
 	configtype="valve_keyvalues"
 }
 }