我最近更新到El Capitan,我一直在看我的終端出現了一些問題,並將其縮小到我的.bash_profile。我在.bash_profile中有這個,所以提示會根據git的變化改變顏色。OSX El Capitan終端/ .bash_profile顏色錯誤
# A more colorful prompt
# \[\e[0m\] resets the color to default color
c_reset='\[\e[0m\]'
# \e[0;31m\ sets the color to red
c_path='\[\e[0;31m\]'
# \e[0;32m\ sets the color to green
c_git_clean='\[\e[0;32m\]'
# \e[0;31m\ sets the color to red
c_git_dirty='\[\e[0;31m\]'
它與OSX Yosemite的最新更新一起工作。另外,據我所知,顏色代碼是正確的。但是,這是我的終端如何顯示:
github.io [\[\e[0;31m\]working\[\e[0m\]]:>
正如你所看到的,我在我的github目錄的「工作」分支。任何不在github上的東西都顯得很正常。
Downloads:>
至於現在,我已經切換到的iTerm這似乎並沒有對最新版本的問題(這是更新,以適應埃爾卡皮坦)。讓我認爲這是一個終端問題,而不是github。
硬編碼轉義序列保證它只能在特定類型的終端上工作。正確的方法是使用能夠爲終端類型生成適當轉義序列的終端功能。 – alvits