bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Purge History of rm commands


From: Roger
Subject: Re: Purge History of rm commands
Date: Tue, 20 Sep 2011 14:06:14 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

> On Tue, Sep 20, 2011 at 08:58:34AM -0500, Dennis Williamson wrote:

>You can get as fancy as you want with regexes in order to catch all
>cases of "rm" anywhere on the line and reduce the chances of a false
>positive:
>
>gawk '{ c = $0; getline; if ($0 ~
>(^|;[[:space:]]*)\<rm\>[[:space:]]+/) { print c; print; } }'
>.bash_history
>
>might come a little closer, but it would falsely catch "echo 'There
>will be cake; rm 414 is reserved for the party'". It lets your
>"maildirmake" through.
>
>It searches for "rm" anywhere on the line as a "word" (and followed by
>at least one space or tab) at the beginning of the line or after a
>semicolon and optional spaces or tabs.


Well, I'm sure whomever needs to find this thread in the future is now going to
find a real gem of info!

(Started reading the GNU GAWK manual last night and now have a good jump start
on GAWK, along with incorporating regex.)

-- 
Roger
http://rogerx.freeshell.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]