我意识到这可能是一个愚蠢的问题,但我有一个Centos-7最小服务器安装和“哪个”命令不存在或丢失。下面的代码来自一个make文件。
which grep > /dev/null 2> /dev/null
if test "$?" != "0"
then
echo "\"grep\" command not found."
echo "Installation is aborted."
exit 1
fi任何帮助都将不胜感激。这对谷歌来说即使不是不可能,也是困难的。
发布于 2015-01-07 16:49:16
使用yum whatprovides在CentOS中查找包
yum whatprovides *bin/which在本例中,包被称为which,因此
yum install which应该会把它拉进来。
发布于 2015-01-07 16:58:19
您可以使用type命令代替which命令。
type grep > /dev/null 2> /dev/null
if test "$?" != "0"
then
echo "\"grep\" command not found."
echo "Installation is aborted."
exit 1
fihttps://stackoverflow.com/questions/27815420
复制相似问题