[[!tag hack bash]]

I tend toward simplicity, and for years my Bash command line prompt was just either a dollar or hash sign, for normal user or root.

PS1='\$ '

However, at some point, I got confused one too many times about which terminal window was showing which machine, so I added the username and hostname to the prompt:

PS1='\u@\h\$ '

Then it turned out that I got confused about whether I was inside or outside a chroot on those machines, so I added that information:

PS1="$debian_chroot\\u@\\h\\$ "

where debian_chroot gets set to the contents of /etc/debian_chroot if it exists.

Lately, I've been annoyed by the fact that it's hard to quickly visually scan long command line sessions. This is particularly annoying when a command outputs about a screenful of lines of text quickly, making it hard to figure out how much backwards you have to go to see the output.

My solution is to make the Bash prompt be in bold face:

have_term()
{
    [ "$TERM" ] && [ "$TERM" != dumb ]
}

start_bold()
{
    if have_term
    then
        tput sgr0
        tput bold
    fi
}

end_bold()
{
    if have_term
    then
        tput sgr0
    fi
}

PS1="\\[$(start_bold)\\]$debian_chroot\\u@\\h\\$ \\[$(end_bold)\\]"

And that's where we are now. Far away from the beautiful simplicity of a single character prompt.