type命令
1.0、参考
1.1、type命令的类型
Shelltype type
zshtype is a shell builtin
bashtype is a shell builtin
dashtype is a shell builtin
tcshtype is a shell builtin
type is an alias for 'whence -v'
1.2、type命令的作用

type命令用于查看某个命令的类型

1.3、type命令的使用格式
type COMMAND_NAME
1.4、type命令的使用示例
1.4.1、示例1
type which
type command
1.4.2、示例2
if command -v which > /dev/null && [ "$(type which)" = "which is a shell builtin" ]; then
    echo "this is zsh $ZSH_VERSION";
elif command -v caller > /dev/null && [ "$(type caller)" = "caller is a shell builtin" ]; then
    echo "this is bash $BASH_VERSION";
elif command -v enum > /dev/null && [ "$(type enum)" = "enum is a special shell builtin" ]; then
    echo "this is ksh $KSH_VERSION";
else
    echo "this is ash";
fi

依据:

Shell特有的内部命令特有的环境变量
zshwhichZSH_VERSION
bashcallerBASH_VERSION
kshenumKSH_VERSION
tcshbuiltinsversiontcsh