log: warning for potential script crash

This commit is contained in:
Lucas Briese 2023-11-30 14:17:29 +01:00
parent dc83e87e2d
commit 828f56cf22

View File

@ -14,6 +14,10 @@ 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)
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"