我有CentOS版本6.3的CentOS:bash下的grep:找不到命令
我想在脚本中使用grep
,我也得到bash: grep: command not found
。
任何想法如何解决这个问题?
几个月前它工作正常。
我有CentOS版本6.3的CentOS:bash下的grep:找不到命令
我想在脚本中使用grep
,我也得到bash: grep: command not found
。
任何想法如何解决这个问题?
几个月前它工作正常。
/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目录添加到系统路径变量。
'/ usr/bit /'我没有'grep',而是'pgrep','zgrep'等。在'bin'里我什么都没有。 – zinon
您可以从命令行运行'which grep'来查找grep – edi9999
@ edi9999运行'which grep'得到结果'/ usr/bin/which:grep in(/ usr/local/rvm/gems/ruby- 1.9.2-P320 /斌:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.2-p320/bin:在/ usr/local/rvm/bin:/ sbin:/ bin:/ usr/sbin:/ usr/bin)' – zinon
最有可能的是,你已经搞乱了脚本中的PATH变量(在交互式终端中grep工作吗?),或者错误地做了一个令人讨厌的'rm' ...... – anishsane
@anishsane我不是唯一的用户的机器,所以我不知道。我发现问题是正确的。我现在可以做些什么? – zinon