From 71fd27148a708060cb7c87e6eb54110abec1135e Mon Sep 17 00:00:00 2001 From: cschantz Date: Mon, 10 Nov 2025 22:50:17 -0500 Subject: [PATCH] Fix history cleaning - disable history recording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added 'set +o history' to prevent the trace eraser commands from being re-added to history. Changes: • Disable history recording before cleaning (set +o history) • Clear in-memory history with history -c • Write empty history with history -w • Added note to run 'exec bash' for clean shell • Prevents script commands from being saved This ensures the last 10 entries are properly removed and the cleanup commands themselves don't get recorded. --- tools/erase-toolkit-traces.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/erase-toolkit-traces.sh b/tools/erase-toolkit-traces.sh index 3bd6fc4..ee4a2ad 100755 --- a/tools/erase-toolkit-traces.sh +++ b/tools/erase-toolkit-traces.sh @@ -145,6 +145,9 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then echo "" echo "→ Final cleanup: Removing bash history..." + # Disable history recording for this session to prevent re-adding commands + set +o history + # Remove last 10 lines from history file (covers toolkit download/usage) total_lines=$(wc -l < ~/.bash_history) if [ "$total_lines" -gt 10 ]; then @@ -157,12 +160,16 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then echo " ✓ Cleared entire history (had < 10 entries)" fi - # Clear in-memory history and write clean file + # Clear in-memory history completely history -c + + # Write the empty history to file history -w echo "" echo " ✓ Bash history cleaned" + echo "" + echo "NOTE: Run 'exec bash' or logout/login to start fresh shell with clean history." fi echo ""