.bash_profile中损坏的找不到,找不到命令...帮助恢复回它原来的 [英] .bash_profile corrupted not found, command not found... Help restore it back to the original

查看:1779
本文介绍了.bash_profile中损坏的找不到,找不到命令...帮助恢复回它原来的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用我的Mac上安装蒙戈DB玩......和导出MongoDB的/ bin目录到PATH ..貌似我损坏的.bash_profile,现在我找不到它。

这是我做过什么:

 纳米〜/ .bash_profile中

该文件不存在,所以我继续创造了一个并添加以下行

 出口PATH = {$ PATH}:〜/蒙戈/箱

所以现在我保存的文件..由pressing Ctrl + O键,然后按下回车键的提示。然后我pressed CTRL + X退出纳米。我重装用以下命令我的bash配置文件:

  $源〜/ .bash_profile中。

......

现在甚至像开放,透明,grep的等基本命令将导致

-bash:明确:命令未找到

当我这样做

 出口$ PATH

这是显示的内容...

*


  

-bash:出口: `{{/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin':
  不是有效的标识符


*

我是新手在这个..请帮我找回我的,我必须所有MAC访问原始状态和U​​NIX命令。

让我知道你是否需要额外的细节。我的操作系统是山狮。我还曾装X code ..


解决方案

我怀疑的问题是,$ PATH正在扩大,当你不希望它是。 export命令没有任何差别。预计出口环境变量出口的名字,但你不给它的变量的名字,你给它的变量引用本身,这将会扩大。

想想这一点:

 回声路径

输出

  PATH

然而,这

 回声$ PATH

此输出:

<$p$p><$c$c>{{/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin

因此​​,到PATH变量输出,试试这个,而不是(注意缺少美元符号):

 导出路径

另外,我注意到你的$ PATH有一堆在里面花括号。采取这些了。我是pretty肯定是打破的东西。

要做到这一点在一行像你第一次尝试,让我们把它们放在一起:

 出口PATH = $ PATH:〜/蒙戈/箱

I was playing with the installation of Mongo db on my mac... and in exporting the Mongodb/bin dir to PATH .. looks like I corrupted the bash_profile and now I can't find it..

This is what I did :

nano ~/.bash_profile

The file did not exist, so I went ahead created one and added the following line

export PATH={$PATH}:~/mongo/bin

So now I saved the file .. by pressing ctrl + O and then hit Enter at the prompt. Then I pressed ctrl + X to exit nano. I reloaded my bash profile with the following command:

$ source ~/.bash_profile.

.....

Now even the basic commands like open, clear , grep etc would result in

-bash: clear: command not found

When I do

export $PATH

this is what shows up ...

*

-bash: export: `{{/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin': not a valid identifier

*

I am a novice in this.. Please help me get back to my original state where I had access to all the mac and unix commands..

Let me know if you require additional details.. My OS is mountain lion.. I had also XCode installed..

解决方案

I suspect the issue is that $PATH is being expanded when you don't want it to be. The export command isn't treated any differently. Export expects the name of an environment variable to export, but you aren't giving it the name of the variable, you are giving it the variable reference itself, which gets expanded.

Think about this:

echo PATH

outputs

PATH

However, this

echo $PATH

outputs this:

{{/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin}:/Users/pavbond007/Documents/Mongo/mongodb-osx-x86_64-2.2.3/bin

Therefore, to export the PATH variable, try this instead (notice the lack of dollar sign):

export PATH

Also, I noticed your $PATH has a bunch of curly braces in it. Take those out. I'm pretty sure that is breaking things.

To do this in one line like you tried first, let's bring it all together:

export PATH=$PATH:~/mongo/bin

这篇关于.bash_profile中损坏的找不到,找不到命令...帮助恢复回它原来的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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