Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A perl version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A perl version
Authored by: adamjacobmuller on Jun 21, '03 06:59:38PM

hrmmm I think that osxhints strips \'s this is fixed...
I also changed
ps -x
to
ps -cxa


<code>
#!/usr/bin/perl
@procs = `ps -cxa`;
for $proc (@procs ) {
if( $proc =~ /\\s+(\\d+)\\s+\\S+\\s+\\S+\\s+\\S+\\s+(\\S+)/ ) {
$pid = $1;
$name = $2;
if( $name =~ /$ARGV[0]/ ) {
print "$pid ";
}
}
}

print "\\n";
</code>



[ Reply to This | # ]