更改.bash_profile后,每个命令都失败并显示“未找到命令”?

Modified on: Sat, 09 Jun 2018 18:47:23 +0800

我正在更新我的.bash_profile,不幸的是我做了一些更新,现在我得到了:

env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
-bash: tar: command not found
-bash: grep: command not found
-bash: cat: command not found
-bash: find: command not found
-bash: dirname: command not found
-bash: /preexec.sh.lib: No such file or directory
-bash: preexec_install: command not found
-bash: sed: command not found
-bash: git: command not found

我的bash_profile实际上会引入其他.sh文件(来源),所以我不确定哪些修改可能会导致这种情况。

现在,如果我尝试查看文件列表,我会得到:

>ls -bash: ls: command not found -bash: sed: command not found -bash: git: command not found

有关如何跟踪错误来源的任何提示,以及如何使用终端来处理列出文件等基本内容?

作者:Jjed,Blankman

最佳答案

在我看来,您正在覆盖默认的PATH环境变量。您遇到的错误类型表示PATH不包含/bin,其中包含上述命令(包括bash)。

例如,如果你这样做

PATH=/home/user/bin

而不是

PATH="$PATH":/home/user/bin


相关问答

添加新评论