by mbreese · 6y ago · 0 comments
If I rewrote the prompt each time I ran a command, I’d lose that record. (I suppose I could do the same trick in reverse and if I care to know how long a command will take, I could run it and hit enter a few times to queue up an empty command to create the same timestamp effect after the fact).
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash....
It's executed just before the PS1 prompt is printed.
A nice idea I've seen is to use PROMPT_COMMAND to print the time a command finished (and maybe an indication of its exit status) in low-contrast text at the far right of the terminal. Then that info is there if you want to look for it, but it's not distracting.
Then you could have the best of both worlds, and it would all happen without the need to remember to create fresh prompts.