Use same grep logic as trace eraser for history cleaning
Simplified to match the exact logic from erase-toolkit-traces.sh: - Use grep -Ev with pattern matching - Clean file, clear history, reload, unset HISTFILE - Then run trace eraser subprocess for logs/files/directory The key fix is running this in the current shell instead of subprocess.
This commit is contained in:
+1
-1
@@ -1511,7 +1511,7 @@ main() {
|
|||||||
# This ensures the parent shell's history is cleaned
|
# This ensures the parent shell's history is cleaned
|
||||||
GREP_PATTERN="git\.mull\.lol|linux-server-management-toolkit|server-toolkit|launcher\.sh|erase-toolkit-traces"
|
GREP_PATTERN="git\.mull\.lol|linux-server-management-toolkit|server-toolkit|launcher\.sh|erase-toolkit-traces"
|
||||||
|
|
||||||
# Clean the history file
|
# Clean the history file (same logic as trace eraser)
|
||||||
if [ -f ~/.bash_history ]; then
|
if [ -f ~/.bash_history ]; then
|
||||||
cp ~/.bash_history ~/.bash_history.bak.$$
|
cp ~/.bash_history ~/.bash_history.bak.$$
|
||||||
grep -Ev "$GREP_PATTERN" ~/.bash_history.bak.$$ > ~/.bash_history 2>/dev/null || true
|
grep -Ev "$GREP_PATTERN" ~/.bash_history.bak.$$ > ~/.bash_history 2>/dev/null || true
|
||||||
|
|||||||
Reference in New Issue
Block a user