replace type with command

This commit is contained in:
emmett1
2020-02-19 15:23:42 +08:00
parent 00e55a2473
commit 7a91fbdcd4
3 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -350,7 +350,7 @@ fi
shift
if [ $(type -t pkg_$opts) ]; then
if [ $(command -v pkg_$opts) ]; then
pkg_$opts "$@"
else
print_runhelp_msg

View File

@@ -20,7 +20,7 @@
EDITOR=${EDITOR:-vi}
type -p $EDITOR >/dev/null || {
command -v $EDITOR >/dev/null || {
echo "Editor '$EDITOR' not exist. Append 'EDITOR=<your editor>' to ${0##*/}."
exit 2
}