ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.55k stars 626 forks source link

Clearing history doesn't work! #442

Closed mehdiMj-ir closed 1 year ago

mehdiMj-ir commented 1 year ago

Hi dear developer. I use this app on my bash everyday and I'm thankful :) Recently there is a bug in clearing history and I'd like to report. To reproduce the bug:

  1. Type some commands like ls and cd
  2. Type history -c to clear bash history
  3. Close the current terminal
  4. Open another terminal if you type history you will see command which supposed to be clear.
akinomyoga commented 1 year ago

That's the intentional behavior configured by the following line:

https://github.com/ohmybash/oh-my-bash/blob/dd7807fcd2a43339c03402744551eac12f0d669a/lib/history.sh#L13

If you would like to suppress the behavior (i.e., if you would like to entirely replace the command history saved in ~/.bash_history (or $HISTFILE) with that of the last Bash session no matter what history other sessions have saved in the past), you can add the following line after source "$OSH"/oh-my-bash.sh in your ~/.bashrc:

shopt -u histappend
mehdiMj-ir commented 1 year ago

I use this on my servers too and looks like I have to append shopt -u histappend to all of my .bashrc files but hey thanks for your kind response :)