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

[FWP] grepps script...



This is a script I wrote to grep all the user's processes in the
process table *without* returning any of the processes used to do
it (unlike a simple `ps ax|grep foo`, which would randomly return
the "grep foo" process)...

#!/usr/bin/perl -w
die "No search string given!\n" if !defined($ARGV[0]);
$kpid = open(PS_X, "ps x|") or die "Can't open program: $!";
while(<PS_X>) { print if (/$ARGV[0]/ && !/\s*(?:$$|$kpid)/); } 

So, oh great masters of Perl obfuscation and compression, is there
anything obvious that can be done with this to make it even smaller? :)

Thanks,
Stevie

-- 
Stevie Strickland                    |  325912 Georgia Tech Station
sstrickl@cc.gatech.edu               |  Georgia Institute of Technology
http://kelewan.dhis.org/~sstrickl    |  Atlanta, GA 30332
Official Debian GNU/Linux Developer  |  Cyberlink/#Debian on IRC

PGP signature