Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • The second snippet doesn't seem to work. Firstly there are three typos, which I've submitted an edit for, but the main problem is that the DEBUG trap seems to get called before the PROMPT_COMMAND as well, meaning the time gets reset. Maybe that didn't happen in older versions of Bash, idk. Commented Aug 29, 2020 at 18:18
  • The history method doesn't work when you have HISTCONTROL=ignoredups enabled and run the same command twice in a row. Commented Aug 29, 2020 at 20:11