From dce177d9f929c18d5eb2b5164b18f92c701a0052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 21 Dec 2011 01:14:32 -0600 Subject: Some usage messages added --- is_built | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'is_built') diff --git a/is_built b/is_built index f789e4f..60f24e9 100755 --- a/is_built +++ b/is_built @@ -1,11 +1,24 @@ #!/bin/bash -# Detect is a package is installed or in a database +usage() { + echo "$0 " + echo + echo "Detect is a package is installed or in a database" + echo + echo "Example usage: is_built \"pcre>=20\"" +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done # 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. # -Sp works backwards, it will print output only when the package already # exists -# Example usage: is_built "pcre>=20" + !(sudo pacman -T "$1" | egrep "*" >/dev/null) || \ sudo pacman -Sp "$1" --print-format "%n-%v" 2>/dev/null | egrep "*" >/dev/null -- cgit v1.2.2