CentOS:bash:grep:找不到命令

CentOS: bash: grep: command not found

我有 CentOS 6.3 版

我试图在脚本中使用 grep,但我得到了 bash: grep: command not found

有什么解决办法吗?

几个月前它工作正常。

  1. 找到您的 grep 安装路径。很可能是 /bin/grep/usr/bin/grep .
  2. echo "export PATH=$PATH:/<path_to_grep>" >> ~/.bash_profile。请注意,此处的 ~/.bash_profile 表示您的 bash 启动文件。在 bash shell 启动时获取的那个。

万一您出于某种原因没有 grep 或者您就是不能 find / -iname "*grep*"- 您可以下载并安装它:gnu FTP。任何其他可靠来源也可以。然后使用步骤 1 和 2 将您的 grep 目录添加到系统路径变量。