From 7a91fbdcd4a88b46757134b4ccbcc19a3ef48dc5 Mon Sep 17 00:00:00 2001 From: emmett1 Date: Wed, 19 Feb 2020 15:23:42 +0800 Subject: [PATCH] replace type with command --- pkgbuild | 4 ++-- pkgquery | 2 +- updateconf | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgbuild b/pkgbuild index b5cd758..cc150bb 100755 --- a/pkgbuild +++ b/pkgbuild @@ -158,7 +158,7 @@ prepare_src() { if [ "$FILENAME" != "$FILE" ] && [ "$nxt" != 1 ]; then case $FILENAME in *.tar|*.tar.gz|*.tar.Z|*.tgz|*.tar.bz2|*.tbz2|*.tar.xz|*.txz|*.tar.lzma|*.zip|*.rpm) - if [ $(type -p bsdtar) ]; then + if [ $(command -v bsdtar) ]; then COMMAND="bsdtar -p -o -C $SRC -xf $FILENAME" else COMMAND="tar -p -o -C $SRC -xf $FILENAME" @@ -415,7 +415,7 @@ check_buildscript() { elif [ -z "$release" ]; then msgerr "'release' is empty!" exit 1 - elif [ "$(type -t build)" != "function" ]; then + elif [ ! "$(command -v build)" ]; then msgerr "'build' function not exist!" exit 1 elif echo "$version" | grep -q '-'; then diff --git a/pkgquery b/pkgquery index 95da95b..eea1b1b 100755 --- a/pkgquery +++ b/pkgquery @@ -350,7 +350,7 @@ fi shift -if [ $(type -t pkg_$opts) ]; then +if [ $(command -v pkg_$opts) ]; then pkg_$opts "$@" else print_runhelp_msg diff --git a/updateconf b/updateconf index b734456..9df1101 100755 --- a/updateconf +++ b/updateconf @@ -20,7 +20,7 @@ EDITOR=${EDITOR:-vi} -type -p $EDITOR >/dev/null || { +command -v $EDITOR >/dev/null || { echo "Editor '$EDITOR' not exist. Append 'EDITOR=' to ${0##*/}." exit 2 }