As the prompts you use become more complex, it becomes more and more cumbersome to type them in at the prompt, and more practical to make them into some sort of text file. I adopted the method used by the (now long defunct) Bashprompt package, which is to put the primary commands for the prompt in one file with the PS1 string in particular defined within a function of the same name as the file itself. It's not the only way to do it, but it works well. Take the following example:
#!/bin/bash function tonka { # Named "Tonka" because of the colour scheme local WHITE="\[\033[1;37m\]" local LIGHT_BLUE="\[\033[1;34m\]" local YELLOW="\[\033[1;33m\]" local NO_COLOUR="\[\033[0m\]" case $TERM in xterm*|rxvt*) TITLEBAR='\[\033]0;\u@\h:\w\007\]' ;; *) TITLEBAR="" ;; esac PS1="$TITLEBAR\ $YELLOW-$LIGHT_BLUE-(\ $YELLOW\u$LIGHT_BLUE@$YELLOW\h\ $LIGHT_BLUE)-(\ $YELLOW\$PWD\ $LIGHT_BLUE)-$YELLOW-\ \n\ $YELLOW-$LIGHT_BLUE-(\ $YELLOW\D{%H%M}$LIGHT_BLUE:$YELLOW\D{%a,%d %b %y})\ $LIGHT_BLUE:$WHITE\\$ $LIGHT_BLUE)-$YELLOW-$NO_COLOUR " PS2="$LIGHT_BLUE-$YELLOW-$YELLOW-$NO_COLOUR " }
You can work with it as follows:
[1637][giles@glo:/dev (0B)]$ cd [1641][giles@glo:~ (140.97MiB)]$ vim tonka ... [1642][giles@glo:~ (140.97MiB)]$ source tonka [1642][giles@glo:~ (140.97MiB)]$ tonka --(giles@glo)-(/home/giles)-- --(1642:Sun,14 Oct 07:$ )-- unset tonka