Change bash history cleanup to only remove last 10 entries

Reduced from 50 to 10 entries for more targeted cleanup.

Changes:
• Only removes last 10 bash history entries
• More conservative approach
• Still covers toolkit download and usage
• Less impact on normal command history

Tested and confirmed working.
This commit is contained in:
cschantz
2025-11-10 22:47:22 -05:00
parent 53d5b84ea0
commit 0dc684f839
+5 -5
View File
@@ -145,16 +145,16 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then
echo ""
echo "→ Final cleanup: Removing bash history..."
# Remove last 50 lines from history file
# Remove last 10 lines from history file (covers toolkit download/usage)
total_lines=$(wc -l < ~/.bash_history)
if [ "$total_lines" -gt 50 ]; then
lines_to_keep=$((total_lines - 50))
if [ "$total_lines" -gt 10 ]; then
lines_to_keep=$((total_lines - 10))
head -n "$lines_to_keep" ~/.bash_history > ~/.bash_history.tmp
mv ~/.bash_history.tmp ~/.bash_history
echo " ✓ Removed last 50 history entries"
echo " ✓ Removed last 10 history entries"
else
> ~/.bash_history
echo " ✓ Cleared entire history (had < 50 entries)"
echo " ✓ Cleared entire history (had < 10 entries)"
fi
# Clear in-memory history and write clean file