.bashrcとかで以下のように設定 function length() { echo -n ${#1} } function init-prompt-git-branch() { git symbolic-ref HEAD 2>/dev/null >/dev/null && echo "($(git symbolic-ref HEAD 2>/dev/null | sed 's/^refs\/heads\///'))" } if which git 2>/dev/null >/dev/null then export PS1_GIT_BRANCH='\[\e[$[COLUMNS]D\]\[\e[1;31m\]\[\e[$[COLUMNS-$(length $(init-prompt-git-branch))]C\]$(init-prompt-git-branch)\[\e[$[COLUMN