Pimp My Prompt … like Paul Irish

An explanation of some of the parts – see the snippet title for a description of what each one does.

Set the text to colour to MAGENTA and show the logged in username:

${MAGENTA}u

Show the current working directory, in GREEN:

${GREEN}w

Show the git branch, if one exists, including enabled options:

`__git_ps1 " on %s"`

Reset to WHITE, carriage-return plus line-feed, run prefix function:

${WHITE}rn`set_prefix`

Change font colour to CYAN:

${CYAN}

Save the current cursor position:

33[s

Move the cursor 60 columns to the right and display today’s date in parentheses:

33[60C (`date "+%a, %b %d"`)

Restore the cursor position and reset colour to WHITE:

33[u${WHITE}

How do I use it?

You don’t have to do anything other than have the .bash_profile script in your home directory.  BASH will automatically execute it when a BASH shell starts and set everything up for you.

And it looks like this …

Chris’s version of Paul Irish’s OS X prompt

Before you say anything, yes, I’m aware I used a slightly different colour for the date.  😉

The complete script is available on the last page of this article.