zoukankan      html  css  js  c++  java
  • Linux命令之type

    一般情况下,type命令被用于判断另外一个命令是否是内置命令,但是它实际上有更多的用法。

          1.判断一个名字当前是否是alias、keyword、function、builtin、file或者什么都不是:

                type ls 的输出是 ls 是 `ls --color=auto' 的别名

                type if 的输出是 if 是 shell 关键字

                type type 的输出是 type 是 shell 内嵌

                type gedit 的输出是 gedit 是 /usr/bin/gedit

                type frydsh 的输出是 bash: type: frydsh: 未找到

          2.判断一个名字当前是否是alias、keyword、function、builtin、file或者什么都不是的另一种方法(适用于脚本编程):

                type -t ls 的输出是 alias

                type -t if 的输出是 keyword

                type -t type 的输出是 builtin

                type -t gedit 的输出是 file

                type -t frydsh 没有输出

          3.显示一个名字的所有可能:

                type -a kill 的输出是 kill 是 shell 内嵌 和 kill 是 /bin/kill

                type -at kill 的输出是 builtin 和 file

          4.查看一个命令的执行路径(如果它是外部命令的话):

                type -p gedit 的输出是 /usr/bin/gedit

                type -p kill 没有输出(因为kill是内置命令)

          5.强制搜索外部命令:

                type -P kill 的输出是 /bin/kill

  • 相关阅读:
    三道趣味题目
    iOS开发中使用静态库 .a 文件
    java Graphics2D 画图
    堆和栈的区别
    iOS开发中KVC、KVO简介
    GPUImage的简单使用
    OC中 self.view.frame.size.height = 100; 不能通过编译的原因
    Xcode7 低版本iOS系统上下有黑边的问题
    c语言数组赋值
    ELF interpreter /libexec/ld-elf32.so.1 not found
  • 原文地址:https://www.cnblogs.com/oskb/p/3808619.html
Copyright © 2011-2022 走看看