From 0415e307193de628b77322030d224d9479c27b67 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 27 Sep 2020 19:26:41 +0200 Subject: [PATCH] fix probably #4 --- gmod/initConfig.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gmod/initConfig.sh b/gmod/initConfig.sh index 22841d7..a6b619a 100644 --- a/gmod/initConfig.sh +++ b/gmod/initConfig.sh @@ -12,16 +12,14 @@ CFG_PATH="${SERVER_PATH}/garrysmod/cfg/gmodserver.cfg" function configReplace() { source="$1" - target="$source \"$2\"" + target="$2" count=$(grep -Poc "($source).+" "${CFG_PATH}") echo "[initConfig.sh]Request for replacing $source to $target, source is found $count times" if [ "$count" == "1" ]; then - source=$(grep -Po "($source).+" "${CFG_PATH}" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g') - target=$(echo "$target" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g') - sed -i "s/$source/$target/g" "${CFG_PATH}" + sed -Ei "s/${source}.*/${source} ${target}/g" "${CFG_PATH}" elif [ "$count" == "0" ]; then echo "" >> "${CFG_PATH}"