Add history reload after file cleaning to prevent re-adding

Changes:
- Add history -c && history -r after cleaning file
- Reloads cleaned history into current session
- Prevents bash from appending dirty history on shell exit

Issue:
- Trace eraser cleaned file but current session kept dirty history
- On shell exit, bash appended current session to file
- All curl commands were re-added to ~/.bash_history

Solution:
- After cleaning file, clear and reload current session history
- Current session now has only cleaned history
- On exit, only clean commands are appended

Tested:
✓ File cleaned with grep -Ev
✓ Current session reloaded from cleaned file
This commit is contained in:
cschantz
2025-11-11 17:28:58 -05:00
parent f9ca08fc3f
commit 87840a9d20
+7 -3
View File
@@ -167,11 +167,15 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then
echo " ✓ History file cleaned" echo " ✓ History file cleaned"
fi fi
# Reload cleaned history into current session to prevent re-adding on exit
echo " → Reloading cleaned history into current session..."
history -c
history -r
echo " ✓ In-memory history reloaded from cleaned file" echo " ✓ In-memory history reloaded from cleaned file"
echo "" echo ""
echo "NOTE: Other active terminal sessions may still have old history in memory." echo "NOTE: For complete cleanup, run 'exec bash' to start a fresh shell."
echo " Run 'exec bash' or 'history -c && history -r' in those terminals," echo " This prevents any lingering history from being re-saved."
echo " or simply logout/login to start completely fresh."
fi fi
# Offer to remove the entire toolkit (AFTER history cleaning) # Offer to remove the entire toolkit (AFTER history cleaning)