My .git/hooks/commit-msg file looks like
#!/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
But when I run
git commit -m "test commit"
I get the error ".git/hooks/commit-msg: 4: .git/hooks/commit-msg: [[: not found. I can't see anything wrong with my syntax. What could be causing this error?