Add history command removal to trace eraser
Changes: - Remove all 'history' command entries after toolkit cleanup - Prevents showing investigation/debugging commands - Uses same history -d approach for consistency Removes: - history - history | grep curl - cat .bash_history - Any other history command variants Tested: ✓ Removed 3 history command entries from test ✓ Only clean commands remain in history
This commit is contained in:
@@ -163,6 +163,19 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then
|
|||||||
|
|
||||||
echo " ✓ Removed $entries_count toolkit-related entries from in-memory history"
|
echo " ✓ Removed $entries_count toolkit-related entries from in-memory history"
|
||||||
|
|
||||||
|
# Also remove any 'history' commands that might show investigation
|
||||||
|
echo " → Removing history command traces..."
|
||||||
|
history_entries=$(history | grep -E '^\s*[0-9]+\s+.*history' | awk '{print $1}' | sort -rn)
|
||||||
|
history_count=$(echo "$history_entries" | grep -c '^' 2>/dev/null || echo 0)
|
||||||
|
|
||||||
|
for entry_num in $history_entries; do
|
||||||
|
history -d "$entry_num" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$history_count" -gt 0 ]; then
|
||||||
|
echo " ✓ Removed $history_count history command entries"
|
||||||
|
fi
|
||||||
|
|
||||||
# Write cleaned in-memory history back to file
|
# Write cleaned in-memory history back to file
|
||||||
history -w
|
history -w
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user