log: warning for potential script crash
This commit is contained in:
		| @ -13,6 +13,10 @@ CFG_PATH="${SERVER_PATH}/garrysmod/cfg/gmodserver.cfg" | |||||||
| function configReplace() { | function configReplace() { | ||||||
| 	source="$1" | 	source="$1" | ||||||
| 	target="\"$2\"" | 	target="\"$2\"" | ||||||
|  |  | ||||||
|  | 	if ! echo "$2" | grep -qe "^[a-zA-Z0-9_-]+$"; then | ||||||
|  | 		echo "[initConfig.sh]Warning your configured value for $source doesn't match regex ^[a-zA-Z0-9_-]+$. Special symbols could crash this script because they are not sanitized." | ||||||
|  | 	fi | ||||||
| 	 | 	 | ||||||
| 	count=$(grep -Poc "($source).+" "${CFG_PATH}" || echo 0) | 	count=$(grep -Poc "($source).+" "${CFG_PATH}" || echo 0) | ||||||
| 	 | 	 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user