From c02556e2905dc1801d751db8cc3e96ccbedb76ab Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 24 Mar 2011 10:10:05 -0400 Subject: Rely on the return value of type instead of its output Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- contrib/pacscripts.in | 2 +- scripts/makepkg.sh.in | 4 ++-- scripts/repo-add.sh.in | 4 ++-- test/util/vercmptest.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/pacscripts.in b/contrib/pacscripts.in index d3664091..8ad5173b 100755 --- a/contrib/pacscripts.in +++ b/contrib/pacscripts.in @@ -61,7 +61,7 @@ spacman() { if [ $EUID -eq 0 ]; then pacman "$@" else - if [ ! "$(type -p sudo)" ]; then + if ! type -p sudo; then error "Cannot find the sudo binary! Is sudo installed?" error "Otherwise try to run the program as root" exit 1 diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 93cf5662..f6bbe90c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -392,7 +392,7 @@ run_pacman() { local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$ ]]; then - if [ "$(type -p sudo)" ]; then + if type -p sudo >/dev/null; then cmd="sudo $cmd" else cmd="su -c '$cmd'" @@ -1112,7 +1112,7 @@ create_signature() { local ret=0 local filename="$1" msg "$(gettext "Signing package...")" - if [ ! $(type -p "gpg") ]; then + if ! type -p gpg >/dev/null; then error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" exit 1 # $E_MISSING_PROGRAM fi diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 9b57ba76..4447732d 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -193,7 +193,7 @@ create_signature() { local dbfile="$1" local ret=0 msg "$(gettext "Signing database...")" - if [ ! $(type -p "gpg") ]; then + if ! type -p gpg; then error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" exit 1 # $E_MISSING_PROGRAM fi @@ -211,7 +211,7 @@ verify_signature() { local dbfile="$1" local ret=0 msg "$(gettext "Verifying database signature...")" - if [ ! $(type -p "gpg") ]; then + if ! type -p gpg; then error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" exit 1 # $E_MISSING_PROGRAM fi diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh index a9ed3b2a..0e799789 100755 --- a/test/util/vercmptest.sh +++ b/test/util/vercmptest.sh @@ -62,7 +62,7 @@ runtest() { # use first arg as our binary if specified [ -n "$1" ] && bin="$1" -if [ ! $(type -p "$bin") ]; then +if ! type -p "$bin"; then echo "vercmp binary ($bin) could not be located" exit 1 fi -- cgit v1.2.3-2-g168b