So - this is an illustration of stupidity. Not interested in how stupidity ends up on Stack Overflow? Stop reading.
I was trying to add time to my prompt. Rather than relying on \t, I wanted to use date (I have a prompt file that is used across shells). Full of confidence (and who wouldn't be - it's just date, right? It's not like I'm trying to configure sendmail or anything), I added this to my PS1:
date "%H:%M" # << the 1st stupid thing I did
… then switched to my prompt. At this point I suddenly thought "I'm sure there's a shorthand for %H:%M", and called up the manpage.
Then I reloaded my profile (not noticing the error I got - the 2nd stupid thing I did) and typed
date "+%R"
… and obviously got both the output of date, and the error. Cue half an hour of me mashing my face into the desk and asking SO for help while the answer was right in front of me - the output of date and the error. I'd managed in the space of about 20 seconds to completely forget I'd added anything to my .bash_profile.
Beggars belief.
My lessons from this:
- Don't get distracted
- Follow a sequence
- Quit fiddling with your damned PS1 and do some real work for a change
alias | grep -i date?LC_ALL=C date +...?