fix probably #4
This commit is contained in:
parent
6d1d239f7c
commit
0415e30719
@ -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}"
|
||||
|
Loading…
Reference in New Issue
Block a user