I'm sure this is a small thing, but I'm relatively new to bash and regular expressions,
given a string summary = 689 in 2s = 350.3/s Avg: 4 Min: 0 Max: 84 Err: 24 (3.48%)
I want to check if the text Err: [1-9]
occurs in the given string in a bash script. In order to achieve that I have written the following script
digit="Err: 8"
if [[ $digit =~ 'Err: [1-9]' ]];
then
echo "$digit is a digit"
else
echo "oops"
fi
However this does not work, it will goes into the false. When I tested the regular expression with an online tool it seem to work fine, I'm not sure whats wrong here.