bash Linux 输出路径错误。如何恢复 ~./bashrc 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5361937/
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
Linux wrong path exported. How to recover ~./bashrc file
提问by Ananth Duari
While I try to set java path on ~./bashrcfile i exported like:
当我尝试在~./bashrc我导出的文件上设置 java 路径时:
PATH=/usr/local/jdk1.6.0/bin
export PATH
which I guess makes all the other path missing.So it makes me any of the core command like cp not working. I am aware the default ~./bashrcfile will be there on /etc/skel. But since none of the common comments working i am not able to copy it. Is there any way we can revert original ~./bashrc?
我猜这让所有其他路径都丢失了。所以它让我像 cp 这样的任何核心命令都不起作用。我知道默认~./bashrc文件将在/etc/skel. 但由于没有一个常见的评论有效,我无法复制它。有什么办法可以恢复原样~./bashrc吗?
回答by Mat
Put something like:
放一些类似的东西:
PATH=/your/jdk/bin/path:${PATH}
export PATH
That way, your path gets prependedto the regular PATHenvironment.
这样,您的路径就会预先添加到常规PATH环境中。
And simply log out and log back in to reset your environment. Or type this:
只需注销并重新登录即可重置您的环境。或者输入这个:
export PATH=/usr/bin:/usr/local/bin
or this
或这个
. /etc/profile
to reload a basic environment if you can't get an editor to work right now.
如果您现在无法让编辑器工作,请重新加载基本环境。
回答by LHMathies
You can always run commands with absolute paths, like
您始终可以使用绝对路径运行命令,例如
/bin/cp /etc/skel/.bashrc .bashrc

