Light-weight Prompt

One of the first prompts I produced myself. Shows how to use colour in a prompt, looks okay (if you like blue and red - limited colour choices ...). Also modifies the title of xterms (if you are in one - it checks) to reflect similar information to the prompt.

Code:


#!/bin/bash
function proml {
local       BLUE="\[\033[0;34m\]"
local        RED="\[\033[0;31m\]"
local  LIGHT_RED="\[\033[1;31m\]"
local      WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="${TITLEBAR}\
$BLUE[$RED\$(date +%H%M)$BLUE]\
$BLUE[$LIGHT_RED\u@\h:\w$BLUE]\
$WHITE\$$LIGHT_GRAY "
PS2='> '
PS4='+ '
}


https://www.gilesorr.com/bashprompt/prompts/proml.html 
by giles