终端启动时的错误消息 [英] Error message on Terminal launch

查看:21
本文介绍了终端启动时的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每次启动终端时都会收到此错误消息:

I receive this error message each time I launch terminal:

-bash: =/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin: No such file or directory

推荐答案

您最近编辑了一个 shell 的启动文件并引入了错误.

You have recently edited one of your shell's startup files and introduced an error.

可能,ls -lart ~/.bashrc ~/.bash_profile ~/.profile 会指出哪一个 -- 如果缺少一个或多个,那没关系,我们只是想看看哪个其中一个是您最近编辑过的.检查时间戳并尝试记住您为更改这些文件之一所做的操作.

Probably, ls -lart ~/.bashrc ~/.bash_profile ~/.profile will indicate which one -- if one or more is missing, that's no concern, we just want to see which one out of these you have edited recently. Examine the time stamps and try to remember what you did to change one of these files.

错误可能看起来像

$oopsPATH=/usr/local/bin:$PATH

你想说的地方

PATH=/usr/local/bin:$PATH

但如果无法访问您的文件,我们就无法知道那里究竟应该有什么,或者您是如何搞砸的.

but without access to your files, we can't know what exactly is supposed to be there, or how you messed it up.

另见 https://askubuntu.com/questions/198730/how-to-restore-bashrc-file/198740#198740

在您弄乱了 PATH 以至于 ls 和其他命令不可用的常见情况下(bash: ls: command not found),您可以使用完整路径(/bin/ls pro ls 等;但显然,您必须知道正确的路径)至少直到您可以恢复您的配置.

In the common case where you have messed up your PATH so that ls and other commands are unavailable (bash: ls: command not found), you can use the full path (/bin/ls pro ls, etc; though obviously, you have to know the correct path) at least until you can restore your configuration.

PATH=/usr/local/bin:/usr/bin:/bin

可能是一个很好的拐杖,直到您可以为您的操作系统找到正确的默认值.您可以在提示符下输入,或者将其放入您的 shell 的启动文件之一并启动一个新的 shell.

is probably a good crutch until you can find the correct default for your OS. You can type that at the prompt, or put it in one of your shell's startup files and start a new shell.

在许多平台上,您可以在 /etc/skel 中找到默认的用户点文件,如果存在的话(不幸的是,这不适用于 Mac OS,但在大多数 Linux 上应该存在):

On many platforms, you can find the default user dot files in /etc/skel so if that's present (which unfortunately will not be true for Mac OS, but should be there on most Linuxes):

 cp -b /etc/skel/.bash_profile $HOME/

将用系统默认值替换您的(可能损坏无法修复).bash_profile.(如果您的操作系统没有 -b 选项,请省略它,但您需要在替换之前手动备份文件.)

will replace your (presumably broken beyond repair) .bash_profile with the system default one. (Omit the -b option if your OS doesn't have it, but then you'll want to back up your file manually before replacing it.)

更新:.bash_profile 顶部附近的这个片段是错误的:

Update: This fragment near the top of your .bash_profile is erroneous:

#loginPath
=/usr/local/bin:$PATH

把它拿出来;它似乎没有做任何有用的事情.MacPorts 安装程序中似乎有多个额外的片段看起来也有问题,但它们只是注释.(也许他们不应该这样?)

Just take it out; it doesn't seem to do anything useful. There seem to be multiple additional fragments from the MacPorts installer which look wrong, too, but they are just comments. (Perhaps somehow they shouldn't be?)

这篇关于终端启动时的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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