A usable bash prompt

I have done my share of bash scripting, but for the life of me I couldn’t get a color bash prompt working. I used to wire it with code like: PS1="\e[0;31m[\u@\h \W]\$ \e[m " (I got it from sites like cyberciti. And these would never work, it would color the prompt alright, but it would screw up the cursor position. Today, I found that this syntax is actually used to set the cursor position. Anyway, I finally have a bash color prompt working without screwing up my cursor position here it is:

1
2
#~/.bashrc
PS1="\[\033[1;31m\]\h\[\033[00m\] \[\033[1;33m\]\W\[\033[00m\] \[\033[0;36m\]\$\[\033[00m\] "

Most of the code here is for coloring the prompt, you can read more about it at the excellent archlinux wiki

Screenshot: Screenshot


I am currently working on LiveForm which makes setting up contact forms on your website a breeze.