校园微信网站模板,旅游网站html模板,微网站 源码 免费,add_filter wordpress1、command解释
command命令在shell脚本里面#xff0c;如果发现有个函数和我们需要执行的命令同名#xff0c;我们可以用command用来强制执行后面的命令#xff0c;而不是同名函数#xff0c;然后我们也可以在shell脚本里面判断莫个命令是否存在#xff0c;我们平时一般…1、command解释
command命令在shell脚本里面如果发现有个函数和我们需要执行的命令同名我们可以用command用来强制执行后面的命令而不是同名函数然后我们也可以在shell脚本里面判断莫个命令是否存在我们平时一般用which命令也行。 2、测试代码
#!/bin/bashfunction pwd()
{echo I am pwd function
}echo shell run pwd
pwdecho shell command pwd
command pwdif command -v pwd /dev/null; thenecho pwd command has found
elseecho pwd command has not found
fiif command -v pwd1 /dev/null; thenecho pwd1 command has found
elseecho pwd1 command has not found
fi 3、运行结果
./command
shell run pwd
I am pwd function
shell command pwd
/home/chenyu/Desktop/linux/dabian/python
pwd command has found
pwd1 command has not found