PS1シェルプロンプト

素晴らしいシェルプロンプトを作っている人が。。
gitのブランチをプロンプトにだすという素晴らしいアイディア
http://unix.stackexchange.com/a/178817

Bash $PS1 Generator2.0を使ってさらに好みにしてみた
https://www.kirsle.net/wizards/ps1.html

~/.bashrc以下を追加

git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
 # Custom bash prompt via kirsle.net/wizards/ps1.html
 export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\t \[$(tput setaf 4)\]\u@\h\[$(tput setaf 1)\] \W \[$(tput setaf 3)\]\$(git_branch)\[$(tput sgr0)\] $ \[$(tput sgr0)\]"

gitないとき

# Custom bash prompt via kirsle.net/wizards/ps1.html
 export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\t \[$(tput setaf 4)\]\u@\h\[$(tput setaf 1)\] \W \[$(tput sgr0)\] $ \[$(tput sgr0)\]"

完成!!