显示指定命令的类型。
type [-afptP] name [name ...]
当指定的命令可以找到时返回成功,如果有没找到的返回失败。
接下来要用到的例子假设'~/.bashrc'文件定义了以下的内容:
alias ls='ls --color=auto'
test123(){ vim ~/.bashrc; }
而且执行环境里没有使用enable禁用内建命令。
type -a test123
test123 is a function
test123 ()
{
vim ~/.bashrc
}
type -a -f test123
bash: type: test123: not found
type -a -p test123
type -a ls
ls is aliased to `ls --color=suto'
ls is /usr/bin/ls
ls is /bin/ls
type -a -p ls
/usr/bin/ls
/bin/ls
type -p printf
type -P printf
/usr/bin/printf
/bin/printf
type -t ls
alias
type -t for
keyword
type -t test123
function
type -t -f test123
type -t printf
builtin
type -t chmod
file
help
命令。builtin
命令。原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。