bash 打开时终端显示“没有这样的文件或目录”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30373336/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:01:13  来源:igfitidea点击:

Terminal says 'No such file or directory' when open

macosgitbashterminal

提问by Alan

In the last couple of days my terminal has been saying

在过去的几天里,我的终端一直在说

-bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin: No such file or directory

-bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin: No such file or directory

However, all of the above do exist. I was playing around with $PATHvariable last week but the error I am now getting appeared days after I stopped playing with the $PATHvariable.

但是,上述所有情况确实存在。$PATH上周我一直在玩变量,但是在我停止玩$PATH变量几天后,我现在遇到的错误出现了。

Here's a screenshot of the error in my termianl.app

这是我的 termianl.app 中错误的屏幕截图

Here are the contents of my .bash_profile that I was playing about with too:

以下是我也在玩的 .bash_profile 的内容:

The contents of my .bash_profile

我的 .bash_profile 的内容

采纳答案by Etan Reisner

The first line of your .bash_profileis the problem.

你的第一行.bash_profile是问题所在。

That line is attempting to run /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/binas a command which causes the error you see when you start the shell.

该行试图/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin作为命令运行,这会导致您在启动 shell 时看到的错误。

Remove that line and the error should go away.

删除该行,错误应该消失。