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 99ee58ca1e
commit 93d072ccf4
+5 -5
View File
@@ -145,16 +145,16 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then
echo "" echo ""
echo "→ Final cleanup: Removing bash history..." 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) total_lines=$(wc -l < ~/.bash_history)
if [ "$total_lines" -gt 50 ]; then if [ "$total_lines" -gt 10 ]; then
lines_to_keep=$((total_lines - 50)) lines_to_keep=$((total_lines - 10))
head -n "$lines_to_keep" ~/.bash_history > ~/.bash_history.tmp head -n "$lines_to_keep" ~/.bash_history > ~/.bash_history.tmp
mv ~/.bash_history.tmp ~/.bash_history mv ~/.bash_history.tmp ~/.bash_history
echo " ✓ Removed last 50 history entries" echo " ✓ Removed last 10 history entries"
else else
> ~/.bash_history > ~/.bash_history
echo " ✓ Cleared entire history (had < 50 entries)" echo " ✓ Cleared entire history (had < 10 entries)"
fi fi
# Clear in-memory history and write clean file # Clear in-memory history and write clean file