3 ms·
You could probably (I haven’t tested it) append the run time as a comment to the history using something like PROMPT_COMMAND and `history -r <(…)`, instead of c
by layer8 1y ago
You could probably (I haven’t tested it) append the run time as a comment to the history using something like PROMPT_COMMAND and `history -r <(…)`, instead of cluttering the prompt with it. And the start time is already in the history, using HISTTIMEFORMAT.
- hiAndrewQuinn 1y agoPer the Bash `history` manpage: int history_write_timestamps If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, [...] So this isn't true by default on many machines unless it is explicitly turned on. Once you do have it on, of course, then I agree.
- layer8 1y agoThat’s why I wrote “using HISTTIMEFORMAT”, which turns it on. It’s reasonably common to do that.
- bedlamite 1y agoThis is why I really appreciate tools like Atuin. It augments your history with extra data such as the working directory, exit code, time to run command.