When I call bin/console --version in a Symfony project from my terminal, I get Symfony 4.4.3 (env: dev, debug: true)
I like to do a match to see that verifies that the result of the command does in fact match the expected pattern.
I've got this pattern: https://regex101.com/r/n2hBR8/1
I've tried several things in my Bash script, but I can't get it to work:
#symfonyVersionRegex="Symfony\s\d{1}.*"
#symfonyVersionRegex="^Symfony\s\d{1}.*$"
symfonyVersionRegex="^Symfony\s\d.*$"
symfonyVersionRaw=`bin/console --version`
if [[ symfonyVersionRaw =~ $symfonyVersionRegex ]]; then
echo Version number found
else
echo Version number NOT found
fi
When I echo the symfonyVersionRaw I get the expected version string, so that works but no matter what I try, I always get a negative result ("Version number NOT found").