Use "brew list <name>" instead of grepping the output of "brew list".

Some brew packages are not listed with their package name, e.g. libjpeg.