這是我的腳本,設置了我的bash的PS1PS1 bash命令替換10
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
Cyan="\[\033[0;36m\]" # Cyan
White="\[\033[0;37m\]" # White
# Bold
BBlack="\[\033[1;30m\]" # Black
BRed="\[\033[1;31m\]" # Red
BGreen="\[\033[1;32m\]" # Green
BYellow="\[\033[1;33m\]" # Yellow
BBlue="\[\033[1;34m\]" # Blue
BPurple="\[\033[1;35m\]" # Purple
BCyan="\[\033[1;36m\]" # Cyan
BWhite="\[\033[1;37m\]" # White
# Various variables you might want for your PS1 prompt instead
Time12h="\T"
Time12a="\@"
PathShort="\w"
PathFull="\W"
NewLine="\n"
Jobs="\j"
GIT_PS1_SHOWDIRTYSTATE="true"
PS1="\n${BBlack}\[email protected]\h ${BRed}\w${BYellow}\$(__git_ps1 ' { %s }')${BGreen}\n$ "
它是完美的工作,直到昨天,當我決定更新我的筆記本電腦到Windows 10
現在它拋出這個錯誤:
bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `__git_ps1 ' { %s }')'
任何想法是什麼導致此錯誤?
好找。我一直喜歡單行提示'PS1 ='\ [\ e [0; 37m \] \ D {%R} \ [\ e [1; 34m \] \ h:\ w> \ [\ e [ 0m \]「'給它一個旋轉(我用一個黑暗的xterm)。 –
也幫助了我,謝謝!必須在Git \ etc \ profile中更改一行,重新啓動控制檯,就像魅力一樣。 – FloppyNotFound
當您使用PS1 =「bla bla」的雙引號時,當您使用.git repo進入和退出文件夾時,它會自動刷新?因爲我的bash 4.3.42(5)-release(x86_64-pc-msys)只會在你登錄特定目錄時刷新,然後它會卡住分支名稱,即使我改變目錄。 – tvl