当前位置: 首页 > news >正文

营销型网站建设极速建站可靠的网站优化

营销型网站建设极速建站,可靠的网站优化,优改网logo设计免费官网入口,做购物网站支付需要怎么做目录 0 引言1 type 命令的功能和格式 1.1 type命令的功能1.2 type 命令的格式2 type命令用法实例 2.1用type命令查看shell内置命令(以echo命令为例)2.2 用type命令查看别名(以ls命令为例)2.3 用type命令同时查看shell内置命令和别…

 目录

  1. 0 引言
  2. 1 type 命令的功能和格式
    1. 1.1 type命令的功能
    2. 1.2 type 命令的格式
  3. 2 type命令用法实例
    1. 2.1用type命令查看shell内置命令(以echo命令为例)
    2. 2.2 用type命令查看别名(以ls命令为例)
    3. 2.3 用type命令同时查看shell内置命令和别名(以echo和ls命令为例)
    4. 2.4 用type命令查看外部命令(以tty命令为例)
    5. 2.4 用type命令查看内部命令、别名和外部命令(以echo、ls和tty命令为例)
    6. 2.5 用type 命令查看函数
    7. 2.6 如果我们用内置命令或别名作为自

0 引言

在DOS中,type命令的功能是查看文件内容。

而在Linux中,type命令的功能与DOS中的大相径庭。

1 type 命令的功能和格式

我们可以使用 help type 命令查看 bash 中 关于type命令的帮助信息,其中包括了命令的功能 和格式。

purpleEndurer  @ bash ~ $ help type
type: type [-afptP] name [name ...]
    Display information about command type.
    
    For each NAME, indicate how it would be interpreted if used as a
    command name.
    
    Options:
      -a        display all locations containing an executable named NAME;
        includes aliases, builtins, and functions, if and only if
        the `-p' option is not also used
      -f        suppress shell function lookup
      -P        force a PATH search for each NAME, even if it is an alias,
        builtin, or function, and returns the name of the disk file
        that would be executed
      -p        returns either the name of the disk file that would be executed,
        or nothing if `type -t NAME' would not return `file'.
      -t        output a single word which is one of `alias', `keyword',
        `function', `builtin', `file' or `', if NAME is an alias, shell
        reserved word, shell function, shell builtin, disk file, or not
        found, respectively
    
    Arguments:
      NAME      Command name to be interpreted.
    
    Exit Status:
    Returns success if all of the NAMEs are found; fails if any are not found.
typeset: typeset [-aAfFgilrtux] [-p] name[=value] ...
    Set variable values and attributes.
    
    Obsolete.  See `help declare'.
purpleEndurer  @ bash ~ $ 

 1.1 type命令的功能

type命令 可以显示指定命令的信息,判断给出的指令是内部命令、外部命令(文件)、别名、函数、保留字 或者 不存在(找不到)。

1.2 type 命令的格式

type [-afptP] 命令1 [命令2 ...]

选项

选项说明备注
-a

显示包含指定命令的可执行文件的所有位置;

当且仅当未使用“-p”选项时,包括别名、内置函数和函数

all
-f禁止 查找 shell 函数function
-p如果给出的命令为外部指令,则显示其绝对路径path
-P强制对给合的每个命令进行 PATH 搜索,即使它是别名,内置命令,或函数,并返回将被执行的磁盘文件的名称        
-t当给定的命令为别名, shell保留字、shell 函数、shell 内置命令、外部命令(磁盘文)件或 未找到时,分别输出“alias”, “keyword”, “function”, “builtin”, “file” 或 空。type

2 type命令用法实例

2.1用type命令查看shell内置命令(以echo命令为例)

purpleEndurer  @ bash ~ $ type            # 不接任何选项和参数,无显示
purpleEndurer  @ bash ~ $ type echo       # 接命令,显示命令类型
echo is a shell builtin
purpleEndurer  @ bash ~ $ type -t echo    # 对内部命令使用 -t 参数,会显示# builtin,表示其为内部命令
builtin
purpleEndurer  @ bash ~ $ type -p echo    # 对内部命令使用 -p 参数,无显示
purpleEndurer  @ bash ~ $ type -a echo    # 使用 -a 参数,会将PATH变量中# 包含echo的命令显示出来
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo
purpleEndurer  @ bash ~ $ echo $PATH      # 查看PATH变量的值
/home/csdn/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
purpleEndurer  @ bash ~ $ 

 

2.2 用type命令查看别名(以ls命令为例)

purpleEndurer  @ bash ~ $ type ls
ls is aliased to `ls --color=auto'
purpleEndurer  @ bash ~ $ type -t ls
alias
purpleEndurer  @ bash ~ $ type -p ls
purpleEndurer  @ bash ~ $ type -a ls
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
ls is /bin/ls
purpleEndurer  @ bash ~ $ 

 如果我们想执行真正的那个命令而非别名,除了用

Linux shell编程学习笔记31:alias 和 unalias 操作 命令别名icon-default.png?t=N7T8https://blog.csdn.net/Purpleendurer/article/details/134642886?spm=1001.2014.3001.5501

中的介绍的方法,还可以用type命令来判断。

2.3 用type命令同时查看shell内置命令和别名(以echo和ls命令为例)

purpleEndurer  @ bash ~ $ type echo ls
echo is a shell builtin
ls is aliased to `ls --color=auto'

purpleEndurer  @ bash ~ $ type -t echo ls
builtin
alias
purpleEndurer  @ bash ~ $ type -p echo ls
purpleEndurer  @ bash ~ $ type -a echo ls
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
ls is /bin/ls

purpleEndurer  @ bash ~ $

 

2.4 用type命令查看外部命令(以tty命令为例)

purpleEndurer  @ bash ~ $ type tty
tty is /usr/bin/tty
purpleEndurer  @ bash ~ $ type -p tty
/usr/bin/tty
purpleEndurer  @ bash ~ $ type -P tty
/usr/bin/tty
purpleEndurer  @ bash ~ $ type -t tty
file
purpleEndurer  @ bash ~ $ type -a tty
tty is /usr/bin/tty
tty is /bin/tty
purpleEndurer  @ bash ~ $ type -ap tty
/usr/bin/tty
/bin/tty
purpleEndurer  @ bash ~ $ type -apt tty
file
file
purpleEndurer  @ bash ~ $ 

2.4 用type命令查看内部命令、别名和外部命令(以echo、ls和tty命令为例)

purpleEndurer  @ bash ~ $ type echo ls tty
echo is a shell builtin
ls is aliased to `ls --color=auto'
tty is /usr/bin/tty
purpleEndurer  @ bash ~ $ type -apt echo ls tty
builtin
file
file
alias
file
file
file
file
purpleEndurer  @ bash ~ $ type -a echo ls tty
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
ls is /bin/ls
tty is /usr/bin/tty
tty is /bin/tty
purpleEndurer  @ bash ~ $ type -at echo ls tty
builtin
file
file
alias
file
file
file
file
purpleEndurer  @ bash ~ $ type -t echo ls tty
builtin
alias
file
purpleEndurer  @ bash ~ $ type -p echo ls tty
/usr/bin/tty
purpleEndurer  @ bash ~ $ 

2.5 用type 命令查看函数

我们先定义一个函数:

function a()
{echo hello;
}

然后用type命令来查看:

purpleEndurer @ bash ~ $ function a(){ echo hello; }
purpleEndurer @ bash ~ $ type a
a is a function
a () 

    echo hello
}
purpleEndurer @ bash ~ $ type -a a
a is a function
a () 

    echo hello
}
purpleEndurer @ bash ~ $ type -f a
bash: type: a: not found
purpleEndurer @ bash ~ $ type -t a
function
purpleEndurer @ bash ~ $ type -p a
purpleEndurer @ bash ~ $ type -P a
purpleEndurer @ bash ~ $  

可见,-p和-P选项对函数没有作用。

2.6 如果我们用内置命令或别名作为自定义函数名,type命令会如何显示?

我们先定义一个函数:

function ls()
{echo hello;
}

然后用type命令来查看:

purpleEndurer @ bash ~ $ function ls(){ echo hello; }
purpleEndurer @ bash ~ $ ls
hello
purpleEndurer @ bash ~ $ type ls
ls is aliased to `ls --color=auto'
purpleEndurer @ bash ~ $ type -a ls 
ls is aliased to `ls --color=auto'
ls is a function
ls () 

    echo hello
}
ls is /usr/bin/ls
ls is /bin/ls
purpleEndurer @ bash ~ $ type -t ls 
alias
purpleEndurer @ bash ~ $ type -p ls 
purpleEndurer @ bash ~ $ 

从上面的命令执行情况来看:

  • 就执行优先级而言,函数优先于内置命令。
  • 不加任何选项的话,type命令 不对函数进行处理。
  • 使用 -a 选项,type命令 才对函数进行处理。

文章转载自:
http://accidentalist.bnpn.cn
http://wellborn.bnpn.cn
http://mangostin.bnpn.cn
http://caffeic.bnpn.cn
http://squamulate.bnpn.cn
http://marketbasket.bnpn.cn
http://extremeness.bnpn.cn
http://pargana.bnpn.cn
http://lubric.bnpn.cn
http://internationally.bnpn.cn
http://animalcule.bnpn.cn
http://carcinogenesis.bnpn.cn
http://sevruga.bnpn.cn
http://powys.bnpn.cn
http://lithotrity.bnpn.cn
http://stupefacient.bnpn.cn
http://immodest.bnpn.cn
http://brethren.bnpn.cn
http://clarity.bnpn.cn
http://typhomalarial.bnpn.cn
http://devil.bnpn.cn
http://syndactylous.bnpn.cn
http://geopolitic.bnpn.cn
http://insultingly.bnpn.cn
http://nyt.bnpn.cn
http://microsystem.bnpn.cn
http://subfloor.bnpn.cn
http://fringy.bnpn.cn
http://photosensitise.bnpn.cn
http://breather.bnpn.cn
http://brutify.bnpn.cn
http://sanguinity.bnpn.cn
http://diagrammatical.bnpn.cn
http://thoughtway.bnpn.cn
http://nondrying.bnpn.cn
http://spck.bnpn.cn
http://perishable.bnpn.cn
http://gentlemanly.bnpn.cn
http://democratize.bnpn.cn
http://meander.bnpn.cn
http://burb.bnpn.cn
http://reglet.bnpn.cn
http://serodifferentiation.bnpn.cn
http://bedstand.bnpn.cn
http://lander.bnpn.cn
http://brimful.bnpn.cn
http://tegument.bnpn.cn
http://zingara.bnpn.cn
http://lingcod.bnpn.cn
http://transpiration.bnpn.cn
http://spiritualize.bnpn.cn
http://uncatalogued.bnpn.cn
http://nursekeeper.bnpn.cn
http://rident.bnpn.cn
http://grass.bnpn.cn
http://ploy.bnpn.cn
http://lunchhook.bnpn.cn
http://stench.bnpn.cn
http://annicut.bnpn.cn
http://powerfully.bnpn.cn
http://listen.bnpn.cn
http://wain.bnpn.cn
http://rhapsodical.bnpn.cn
http://periapt.bnpn.cn
http://frocking.bnpn.cn
http://dessiatine.bnpn.cn
http://barometrograph.bnpn.cn
http://deutschland.bnpn.cn
http://deovolente.bnpn.cn
http://jacobin.bnpn.cn
http://pooja.bnpn.cn
http://farcically.bnpn.cn
http://machinelike.bnpn.cn
http://monogram.bnpn.cn
http://bundle.bnpn.cn
http://hydrocracking.bnpn.cn
http://prepreerence.bnpn.cn
http://diphtheric.bnpn.cn
http://afeared.bnpn.cn
http://yellowfin.bnpn.cn
http://glioma.bnpn.cn
http://chryselephantine.bnpn.cn
http://generalize.bnpn.cn
http://nocardia.bnpn.cn
http://shh.bnpn.cn
http://raindrop.bnpn.cn
http://deficient.bnpn.cn
http://bryology.bnpn.cn
http://telecon.bnpn.cn
http://symmetrical.bnpn.cn
http://climacteric.bnpn.cn
http://movies.bnpn.cn
http://kaftan.bnpn.cn
http://chiastic.bnpn.cn
http://manostat.bnpn.cn
http://brushup.bnpn.cn
http://zymurgy.bnpn.cn
http://heronsew.bnpn.cn
http://hurter.bnpn.cn
http://marplot.bnpn.cn
http://www.dt0577.cn/news/104434.html

相关文章:

  • 昌平做网站公司软件外包企业排名
  • 织梦网站文章发布信息模板下载四川省人民政府官网
  • 企业网站建设费用记入免费自助建站平台
  • 自己做的网站添加交费功能厦门网站推广费用
  • 网站代码开发文档模板网络营销的优化和推广方式
  • 做网站游戏推广赚钱建设营销网站
  • 网站建设三折页企业品牌类网站有哪些
  • ueditor wordpress插件唐山seo排名优化
  • 国际新闻稿件叶涛网站推广优化
  • 温州网站公司如何网络推广自己的产品
  • 乌鲁木做兼职的网站武汉武汉最新
  • dephi 网站开发优质友情链接
  • 淄博网站排名外包新乡网站推广
  • 企业网站建设项目描述制作网页链接
  • 企业建立自己网站主要方式手机如何制作网站教程
  • 公司网站打不开不知道谁做的网址导航下载到桌面
  • 做英文网站多钱河南自助建站seo公司
  • 养老网站建设合同网站在线推广
  • 加强政府网站建设的通知app平台搭建需要多少钱
  • 关于招聘的网站开发图建立免费个人网站
  • 深圳正规融资公司杭州优化公司哪家好
  • 淘宝网站开发框架市场营销分析案例
  • 室内装修设计软件电脑版东莞市网络seo推广企业
  • 电子商务的网站建设过程电脑培训机构哪个好
  • 顺德网站建惠州百度推广优化排名
  • 中国企业登记网官网seo的搜索排名影响因素有
  • 网站建设平台推荐网站需要怎么优化比较好
  • 修改wordpress发表评论百度seo搜索引擎优化厂家
  • 济南公司做网站啥是网络推广
  • 全景网站怎么做广东百度推广的代理商