我有CentOS release 6.3
我试图在脚本中使用grep
,我得到bash: grep: command not found
。
有什么办法解决这个问题吗?
几个月前它还能正常工作。
- 找到grep的安装路径。最有可能是
/bin/grep
或/usr/bin/grep
。 -
echo "export PATH=$PATH:/<path_to_grep>" >> ~/.bash_profile
。注意~/。这里的Bash_profile表示bash启动文件。在bash shell启动时得到的来源。
如果你没有grep或者你不能find / -iname "*grep*"
-你可以下载并安装它:gnu FTP。任何其他可靠的来源也可以。然后使用步骤1和2将grep目录添加到系统路径变量。