diff --git a/tools/erase-toolkit-traces.sh b/tools/erase-toolkit-traces.sh index 0d29cd2..a885f2e 100755 --- a/tools/erase-toolkit-traces.sh +++ b/tools/erase-toolkit-traces.sh @@ -181,6 +181,15 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then echo " ✓ Cleaned history written to file" + # Also clean the history file directly (in case commands are from other sessions) + echo " → Cleaning history file for commands from other sessions..." + if [ -f ~/.bash_history ]; then + cp ~/.bash_history ~/.bash_history.bak.$$ + grep -Ev "$GREP_PATTERN" ~/.bash_history.bak.$$ > ~/.bash_history 2>/dev/null || true + rm -f ~/.bash_history.bak.$$ + echo " ✓ History file cleaned" + fi + echo " ✓ In-memory history reloaded from cleaned file" echo "" echo "NOTE: Other active terminal sessions may still have old history in memory."