Previous version could not work as grep -q does not print anything to stdout, only exits with a status code depending on a match was found or not. Hence the variables were always empty and could not be compared with 0