I have the following bash script:
#!/bin/bash
FILE_CONTENT="fix: 110256 Módulo > Recurso"
REGEX1="^none:\s.*"
REGEX2="^(feat|Feat|feature|Feature|fix|Fix|break|Break|docs|Docs):\s[0-9]{1,}\s.*"
if [[ $FILE_CONTENT =~ $REGEX1 ]]; then
echo "Commit não incluído no CHANGELOG!"
fi
if [[ $FILE_CONTENT =~ $REGEX2 ]]; then
echo "Commit incluído no CHANGELOG!"
else
echo "Bad commit \"$FILE_CONTENT\", verifique o padrão."
echo $ERROR_MSG
exit 1
fi
The script above works fine on a linux box, but not works on a Macos.
When running in a Macos, I'm getting the "Bad commit \"$FILE_CONTENT\", verifique o padrão."
message.
For some reason the REGEX is not working as expected in the Macos.
How can I have a bash script that works in both linux and macos ?