无法访问.bash_profile

Dan*_*anR 0 bash .bash-profile

所以我正在为我的bash配置文件添加一条路径,我不小心用"myname 1"而不是"myname1"启动了它.我觉得这个空间搞砸了.

当我现在打开终端时,我得到:

-bash: export: `1/Documents/android-sdk-macosx/platform-tools:/Users/XXXX/Library/PreferencePanes/MMPane.prefPane/Contents/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier
-bash: dirname: command not found
-bash: /Users/bin/git-prompt.sh: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我知道'1 /是超级混乱,但现在当我再次尝试编辑配置文件时,没有任何作用.我无法使用nano或任何东西访问它.我甚至认为它不能再找到我的个人资料了.

有谁知道我如何访问旧的配置文件来修复我做的编辑?

jwo*_*der 6

您的PATH环境变量现在可能已设置为myname,因此尝试运行命令foo现在仅在名为可执行文件的情况下才有效myname/foo.解决这个问题的方法是给出你想要执行的任何程序的绝对路径.例如,nano很可能存在于您的/usr/bin目录中,因此您应该能够运行它来编辑您.bash_profile的输入:

/usr/bin/nano ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

如果那不是正确的路径,则nano包含/usr/local/bin/nano和其他可能的位置/usr/pkg/bin/nano; 正确答案取决于您的操作系统及其分布.