Return to Snippet

Revision: 4745
at January 18, 2008 19:40 by robh


Initial Code
export MAX_PATH_LENGTH=25
export PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > $MAX_PATH_LENGTH ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'

Initial URL
http://blog.ubrio.us/osx/best-bash-prompt/

Initial Description
A very dynamic and flexible bash prompt. Personally I find this to have everything needed. It shows exit status, shortens itself for long directories, and shows bash history for easy referencing.

Hopefully it doesn't get messed up.

Initial Title
Dynamic BASH Prompt

Initial Tags
Bash, osx

Initial Language
Bash