linux comand 命令,Linux command 命令 command not found command 命令详解 command 命令未找到 command 命令安装 - Command...

显示行号

|

选择喜欢的代码风格

默认

GitHub

Dune

LakeSide

Plateau

Vibrant

Blue

Eighties

Tranquil

command 命令调用并执行指定的命令,command 是一些shell的内建命令。command 命令的作用是无视shell脚本中的“同名”函数,执行特定的命令。

command 命令补充说明:

command命令 调用指定的指令并执行,命令执行时不查询 shell 函数。command 命令只能够执行 shell 内部的命令。

[root@TestMaster ~]

# type command

command is a shell builtin

command 命令语法:

command(参数)

command 命令选项:

command [-p] [-v] [-V] command [arg ...]

Execute the specified command but ignore shell functions when searching for it.

(This is useful when you have a shell function with the same name as a builtin com‐

mand.)

-p search for command using a PATH that guarantees to find all the standard util‐

ities.

-V Do not execute the command but search for the command and print the resolution

of the command search. This is the same as the type builtin.

-v Do not execute the command but search for the command and print the absolute

pathname of utilities, the name for builtins or the expansion of aliases.

command 命令参数:

指令:需要调用的指令及参数。

command 命令实例:

使用command命令调用执行echo Linux,输入如下命令:

command echo Linux #调用执行shell内部指令

#上面的命令执行后,将调用执行命令echo Linux,其执行结果如下:

Linux

写一个 Shell 脚本,test.sh 中构建 ls 函数,大家就可以体会 command 命令的作用:

#!/bin/bash

function ls()

{

echo "CommandNotFound,发音:坑否"

}

echo "--1--"

ls

echo "--2--"

command ls

echo "--3--"

echo command ls

echo "--4--"

$(echo command ls)

--------------

#给脚本增加执行权限,并 test.sh,对比结果

下面是执行结果:

[root@TestMaster /Data]

# ./test.sh

--1--

CommandNotFound,发音:坑否

--2--

Android apps del_kworderds.sh ffmpeg_compress.sh ffmpeg_travel_debug.sh logs SSP.proto test.sh tools webapps

--3--

command ls

--4--

Android apps del_kworderds.sh ffmpeg_compress.sh ffmpeg_travel_debug.sh logs SSP.proto test.sh tools webapps

command 命令评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值