Massively overloaded PS1 for bash

Features are:

  1. The Time, obviously
  2. Your username
  3. A bold "@" if you are the owner of the current directory
  4. The current directory:
    • Yellow if you are below your $HOME
    • Blue if you are somewhere else
    • Brown if you are in a symlinked dir under your $HOME
    • Dark blue if you are in a symlinked dir somewhere else
    • Shortened in the middle
  5. A bold $ if you have write permission in the current directory

The Prompt will show you for example:

23:55 wiebel@hal ~/atHome/local/src $

So this translates, from left to right to:

  • it's 23:55
  • my username is wiebel
  • the current directory is not owned by me
  • my hostname is hal
  • the current directory is symlinked to the Directory ~/atHome but is nowhere below $HOME
  • I do have write permissions