#!/bin/bash MSG=`awk '{printf("%s",$0)}'$1` if [[ $MSG =~ ^(feat|fix|test|refactor|docs|style|chore)[\(.*\)]?[!]?:.*$ ]] then echo -e "\033[32m commit success! \033[0m" else echo -e "\033[31m Error: the commit message is irregular \033[m" echo -e "\033[31m Error: type must be one of [feat,fix,docs,style,refactor,test,chore] \033[m" echo -e "\033[31m eg: feat(user): add the user login \033[m" exit 1 fi