bash 如何从 finder 显示和访问 .bash_profile 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30378829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to show and access .bash_profile file from finder
提问by Neil
I was playing around with setting additional paths within .bash_profile. To see what would happen I did: export PATH="/Users/neil/blah"
and purposefully did not include $PATH
on the end of it. Now of course my path is broken, so when I go into terminal it won't let me type anything.
我正在尝试在.bash_profile 中设置其他路径。为了看看会发生什么,我做了:export PATH="/Users/neil/blah"
并且故意不包括$PATH
在它的末尾。现在当然我的路径坏了,所以当我进入终端时,它不会让我输入任何内容。
Basically what I need to do is find a way to access my .bash_profilefile to fix it in (finder preferably), all without using terminal.
基本上我需要做的是找到一种方法来访问我的.bash_profile文件来修复它(最好是finder),所有这些都不需要使用终端。
Any suggestion on how I can find and modify this hidden file without using terminal?
关于如何在不使用终端的情况下查找和修改此隐藏文件的任何建议?
Thanks in advance!
提前致谢!
采纳答案by errata
Manually type the path ~/.bash_profile into any text editor, or tell finder to show hidden files and navigate there. Also if terminal is having problems you should still be able to ctrl-c out of the messages and cd around the use vim to fix it.
在任何文本编辑器中手动输入路径 ~/.bash_profile,或告诉 finder 显示隐藏文件并在那里导航。此外,如果终端出现问题,您仍然应该能够 ctrl-c 退出消息并 cd 使用 vim 来修复它。
回答by chepner
PATH
is only needed for lookups when you don't provide an absolute path. While
PATH
仅当您不提供绝对路径时才需要查找。尽管
vi .bash_profile
might not work, because the shell doesn't know where vi
is, the following would:
可能不起作用,因为外壳不知道在哪里vi
,以下将:
/usr/bin/vi .bash_profile
(Assuming the vi
actually is in /usr/bin/
).
(假设vi
实际上是在/usr/bin/
)。
回答by AJ.
If you have admin privileges on the computer. Log in as a different user then rename or edit the .bash_profile with the bad PATH.
如果您在计算机上具有管理员权限。以其他用户身份登录,然后使用错误的 PATH 重命名或编辑 .bash_profile。