2012-05-08

Bash Context-Dependent Color Prompt

Perm URL with updates: http://xahlee.org/linux/shell_color_prompt.html

Want your bash prompt be colored and context dependent? like, showing you which git branch you are in?

bash color prompt
Bash context-dependent color prompt

Bash provided a PROMPT_COMMAND hook, that lets you call {shell, perl, python, ruby, …} script to specify your prompt. So, your prompt can show all sort of info and color.

Geologist and Googler Kurt Schwehr shows you how.