#!/usr/bin/env bash error_msg="Aborting commit. Your commit message does not match the regex. Please provide a format like: '#666 foo bar'" msg="`cat $1`" if [[ ! $msg =~ ^#[0-9]{3,9}(.|\n)* ]]; then echo "$error_msg" >&2 exit 1 fi