提问人:Thundercleez 提问时间:8/10/2023 更新时间:8/10/2023 访问量:56
commit-msg 钩子给出“[[: not found”错误
commit-msg hook gives "[[: not found" error
问:
我的 .git/hooks/commit-msg 文件看起来像
#!/bin/sh
COMMIT_MSG_FILE=$1
comm_msg=$(head -l $COMMIT_MSG_FILE)
if [[ $comm_msg =~ ^TASKID-[\d]+ ]]; then
exit 0
else
echo "Commit message must start with task id." >&2
exit 1
fi
但是当我跑步时
git commit -m "test commit"
我收到错误“.git/hooks/commit-msg: 4: .git/hooks/commit-msg: [[: not found.我看不出我的语法有什么问题。可能导致此错误的原因是什么?
答: 暂无答案
评论
$
*
COMMIT_MSG_FILE
comm_msg