我已经尝试安装git 完成.bash在操作系统X使用终端。
需要进行~/.bash_profile
这样的编辑过程。
我用了vi ~/.bash_profile
。发生此变化后,当我打开我的终端我明白了-bash: 400:: command not found
,但我无法再次编辑!
除此之外,我还有二不同的bash_配置文件在我的主目录中,.bash_profile.swo
& .bash_profile.swp
.
谁能告诉我如何解决这个问题?
这是我的.bash_profile
:
# Setting PATH for Python 3.4 # The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH # Setting PATH for Python 3.5 # The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH # added by Anaconda3 4.0.0 installer
export PATH="//anaconda/bin:$PATH" # added by Anaconda3 4.0.0 installer
export PATH="/anaconda/anaconda/bin:$PATH" # Setting PATH for Python 3.5 # The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH # added by Anaconda3 4.1.1 installer
export PATH="//anaconda/bin:$PATH" # Setting PATH for Python 3.5 # The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH # Setting PATH for Python 3.5 # The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH # Setting PATH for Python 3.5 # The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8 # added by Anaconda3 4.1.1 installer
export PATH="/Users/shahramkarimi/anaconda/bin:$PATH" # Setting PATH for Python 3.6 # The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH # added by Anaconda3 4.3.1 installer
export PATH="/Users/shahramkarimi/anaconda/bin:$PATH" # added by Anaconda3 4.3.1 installer
export PATH="/Users/shahramkarimi/anaconda/bin:$PATH" # added by Anaconda3 4.4.0 installer
export PATH="/Users/shahramkarimi/anaconda/bin:$PATH" # added by Anaconda3 5.0.1 installer
export PATH="/Users/shahramkarimi/anaconda3/bin:$PATH" # Show always fullpath on terminal #export PS1='\u@\H:\w$ '
export PS1='\u \w$ '
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
答案1
.bash_profile.swo
和文件.bash_profile.swp
只是 Vim 创建的临时文件。该.swp
文件是在您.bash_profile
在编辑器中打开时创建的,而 是.swo
在您编辑时创建的.bash_profile
并且.bash_profile.swp
已经存在。
对于错误,请检查您的~/.git-completion.bash
、~/.profile
和~/etc/profile
文件。大概有一条线
400::
某处,Bash 将其解释为命令。您可以通过以下命令检查这一点:
grep -H 400 ~/.git-completion.bash ~/.profile ~/etc/profile
(帖子已编辑,感谢@terdon 的建议。)
答案2
$ sudo -i
-bash: 400:: command not found
# ls -rt /etc/bash_completion.d/|tail -1
kubectl
# cat /etc/bash_completion.d/kubectl
400: Invalid request
损坏的 bash 完成文件(kubectl
在本例中)导致了该错误。
删除损坏的文件:
# rm /etc/bash_completion.d/kubectl
# exit
$ sudo -i
享受。