fix probably #4
This commit is contained in:
		@@ -12,16 +12,14 @@ CFG_PATH="${SERVER_PATH}/garrysmod/cfg/gmodserver.cfg"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function configReplace() {
 | 
					function configReplace() {
 | 
				
			||||||
	source="$1"
 | 
						source="$1"
 | 
				
			||||||
	target="$source \"$2\""
 | 
						target="$2"
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	count=$(grep -Poc "($source).+" "${CFG_PATH}")
 | 
						count=$(grep -Poc "($source).+" "${CFG_PATH}")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	echo "[initConfig.sh]Request for replacing $source to $target, source is found $count times"
 | 
						echo "[initConfig.sh]Request for replacing $source to $target, source is found $count times"
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if [ "$count" == "1" ]; then
 | 
						if [ "$count" == "1" ]; then
 | 
				
			||||||
		source=$(grep -Po "($source).+" "${CFG_PATH}" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
 | 
							sed -Ei "s/${source}.*/${source} ${target}/g" "${CFG_PATH}"
 | 
				
			||||||
		target=$(echo "$target" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
 | 
					 | 
				
			||||||
		sed -i "s/$source/$target/g" "${CFG_PATH}"
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	elif [ "$count" == "0" ]; then
 | 
						elif [ "$count" == "0" ]; then
 | 
				
			||||||
		echo "" >> "${CFG_PATH}"
 | 
							echo "" >> "${CFG_PATH}"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user