Bash Centos7“哪个”命令 [英] Bash Centos7 "which" command
本文介绍了Bash Centos7“哪个”命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我意识到这可能是一个愚蠢的问题,但是我安装了Centos-7最小服务器,并且 which命令不存在或丢失。
我有一个需要它的脚本,但我找不到安装它的yum软件包。
I realize this might be a dumb question but I have a Centos-7 minimal server install and the "which" command does not exist or is missing. I have a script that needs it and I cannot find out what the yum package is that installs it. The code is below and is from a make file.
which grep > /dev/null 2> /dev/null
if test "$?" != "0"
then
echo "\"grep\" command not found."
echo "Installation is aborted."
exit 1
fi
任何帮助将不胜感激...这是很难(即使不是不可能)
Any help would be appreciated... this is difficult if not impossible to google
推荐答案
要在CentOS中查找软件包,请使用 yum whatprovides
:
To find a package in CentOS, use yum whatprovides
:
yum whatprovides *bin/which
在这种特殊情况下,该包称为其中
,因此
In this particular case, the package is called which
, so
yum install which
应该安装。
这篇关于Bash Centos7“哪个”命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文