Fix history cleaning - disable history recording
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.
This commit is contained in:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user