#!/bin/bash # Detect is a package is installed or in a database # Checks for package, if -T returns non-zero output, egrep will return 0 # because it finds it, so we negate the value to say it's not built. # Example usage: is_built "pcre>=20" !(sudo pacman -T "$1" | egrep "*" >/dev/null) exit $?