Re:When did I run that command? Update your Bash prompt with...
by countermeasure on Sunday April 19, 2020 @12:47AM
(#22913577)
I'm not sure how it would suit your workflow, but you could try out PROMPT_COMMAND.
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.
Re:When did I run that command? Update your Bash prompt with...
by mkl on Sunday April 19, 2020 @04:44AM
(#22914462)
I think you could do the same thing but put the real time in place of --:--. Then when the command is run, overwrite the time with the current time. You'd only be able to see the time the most recent command took with precision, but that's usually what matters.
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).