Bash Centos7 “哪个"命令 [英] Bash Centos7 "which" command

查看:38
本文介绍了Bash Centos7 “哪个"命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到这可能是一个愚蠢的问题,但我安装了 Centos-7 最小服务器,并且which"命令不存在或丢失.我有一个需要它的脚本,但我找不到安装它的 yum 包.代码如下,来自一个 make 文件.

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

在这种特殊情况下,包被称为which,所以

In this particular case, the package is called which, so

yum install which

应该把它拉进去.

这篇关于Bash Centos7 “哪个"命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆