for pkg in macvim ngrep other needed packages; do
if brew list -1 | grep -q "^${pkg}\$"; then
echo "Package '$pkg' is installed"
else
echo "Package '$pkg' is not installed"
fi
done
# install if we haven't installed any version
brew ls --versions $lib || brew install $lib
# install if we haven't installed latest version
brew outdated $lib || brew install $lib