mdz/paddle/ppyoloe/3_deploy/Deps/modelzoo/.githooks/pre-commit

15 lines
405 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 获取传入的参数
FILENAME=temp.txt
# 检查文件是否存在如果不存在则创建并写入0
if [ ! -f "$FILENAME" ]; then
echo "1" > "$FILENAME"
echo "The current commit times initialized with 1."
else
echo "Add commit times "
NUMBER=$(grep -oE '[0-9]+' "$FILENAME" | head -n 1)
let NUMBER++
echo $NUMBER
echo "$NUMBER" > "$FILENAME"
fi