Quantcast
Viewing all articles
Browse latest Browse all 2722

# bash で __git_ps1 を使うときの注意点

__git_ps1 と 改行の食い合わせを気をつけないとお腹壊す

僕は昔から PS1によく

.bashrc
export PS1="\n [\W]\n"

などのように ダブルコーテーションと \n を使うけど これが行けない。
シングルコーテーション と 改行は '$'\n を であるべきだった。

.bashrc
source ~/.git-prompt.sh
export GIT_PS1_SHOWUPSTREAM=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1=''$'\n [ \w ]  $(__git_ps1)  '$'\n$ '

理由は、追っかけてないのでわからない。


Viewing all articles
Browse latest Browse all 2722

Trending Articles