I usually place the time at the beginning. Another thing to place at the beginning is a (red) exit code of the last command, when that code is not 0.
You need to add some \[ and \] around the escape codes to tell the shell they’re non-printing characters. Otherwise, things like line-wrapping don’t work right. It’s not a problem because of your \n makes it irrelevant, but just a heads up for the future.
What do you use the history count for?
Re:Bash PS1 Generator
by compressedgas on Thursday June 24, 2021 @11:08AM
(#27618725)
That tells one the index to use for !N to repeat that command
!! repeats the last command
!N repeats the command with that index in the history
More detail from my .bashrc:
I define the colors as it makes it easier to modify PS1 when the spirit moves me.I guess using a generator or toolkit could be useful, but I tweaked mine over the years and prefer it just this way.
Edit: I forgot to mention that I use different colors for user vs. root prompts, as that gives immediate visual confirmation of privilege level.