[NetBehaviour] More on recurring histories...

Pall Thayer pallthay at gmail.com
Tue May 26 02:09:36 CEST 2009


Historically, history doesn't necessarily repeat itself because
there's always someone trying to rewrite it. So here you have a script
that will happily rewrite your .bash_history with random pickings from
your executable path.

#!/usr/bin/perl
$bash_history = $ENV{ HOME }."/.bash_history";
@paths = split(':', $ENV{ PATH });
open HISTORY, $bash_history;
while($history = <HISTORY>){
        $this_path = $paths[int(rand((scalar @paths)-1))];
        $path_contents = `ls $this_path`;
        @content_lines = split("\n", $path_contents);
        if(int(rand(2))){
                $new_history .= $content_lines[int(rand((scalar
@content_lines)))]."\n";
        }else{
                $new_history .= $history;
        }
}
close(HISTORY);
open HISTORY, ">", $bash_history;
print HISTORY $new_history;
close(HISTORY);


best r.
Pall

-- 
*****************************
Pall Thayer
artist
http://www.this.is/pallit
*****************************



More information about the NetBehaviour mailing list