SVN Pre Commit 在文件中搜索字符串

SVN Pre Commit search for a string in file

我正在尝试为 SVN 存储库创建一个预提交挂钩,如果版本号包含 7.5,它将阻止提交

VERSIONNUM="<COMMENT>7.5"
grep -Fwq "$VERSIONNUM" APP.CFG
    then
    exit 1
    else
    exit 0
    fi

版本号位于 APP.CFG 文件中,行的开头是 7.5。我不想匹配整行,这就是为什么我在我的 grep 中使用 -w 的原因,我认为如果 $VERSIONNUM 位于文件中的任何位置 returns 匹配

这里是 APP.CFG 文件的内容

> <?xml version="1.0" encoding="utf-8"?> <APP AUTH="" PRODUCTS="2"
> VER="hmidesigner"> <VERSION AUTHOR="CODRA" DATE_NEUTRAL="01/11/2019
> 09:48:48" ID="CODRA.Panorama.Persist" SERIAL_VERSION="7">
> <COMMENT>7.5.17.0</COMMENT>

使用与我最初想要的略有不同的方法让它工作

SVNLOOK diff -t "$TXN" "$REPOS" | grep -i "<COMMENT>7.5." > /dev/null && { echo "Trying to Commit version 7.5" 1>&2; exit 1; }
    exit 0;