[英]Bash errors PS1 and git completion
我試過按照教程@ https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion
這是我的〜/ .bash_profile:
export PATH="/usr/local/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="/usr/local/bin:$PATH"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias gl="git log --all --oneline --decorate --graph --pretty=format:'%h - %C(cyan)%an%Creset, %Cred%d%Creset %C(yellow)%ar%Creset : %s'"
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
if [ -f $(brew --prefix)/etc/bash_completion ]; then
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
#PS1='\u: \W$(__git_ps1 "[%s]") \$ '
PS1='\[\e[32m\]\u: \W$(__git_ps1 "[%s]") \$\[\e[m\] '
fi
我打開終端時遇到的錯誤:
-bash: .: command not found
-bash: GIT_PS1_SHOWDIRTYSTATE=true: command not found
-bash: GIT_PS1_SHOWUNTRACKEDFILES=true: command not found
-bash: #PS1=\u: \W$(__git_ps1 "[%s]") \$ : command not found
-bash: PS1=\[\e[32m\]\u: \W$(__git_ps1 "[%s]") \$\[\e[m\] : command not found
我希望我的PS1看起來像
(user name): (current directory)(current repo branch *status*) $:
謝謝你的任何幫助。
比較在shell上手動輸入bogus命令的輸出:
$ felkj
-bash: felkj: command not found
從您的腳本獲得的輸出:
-bash: .: command not found
-bash: GIT_PS1_SHOWDIRTYSTATE=true: command not found
-bash: GIT_PS1_SHOWUNTRACKEDFILES=true: command not found
-bash: #PS1=\u: \W$(__git_ps1 "[%s]") \$ : command not found
-bash: PS1=\[\e[32m\]\u: \W$(__git_ps1 "[%s]") \$\[\e[m\] : command not found
在-bash:
之后看到額外的空格-bash:
? 那是你的問題。
不知何故,你設法將非ascii空間放入腳本文件中。 再次編輯它們並確保在這些行上使用ascii空格而不是'EN SPACE'(U + 2002)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.