Hi
I am writing a script that uses backquotes and the ps-ef command to print the UID and command for all currently running processes.
#!/usr/bin/perl
use strict;
my $process = `ps -ef`;
while (<>);{
This should flag an error, note the semi-colon
What you are reading from is the null filehandle, perldoc perlop #Search for 'null filehandle'
The output of ps -ef is in the $process scalar, you should either split $process on newlines and loop through that array or use @processes instead of $process
push @process = spilt (/\|/,$_); print "Owner:[1] command:[8]
You have not closed your while loop block, quotes missing in the print statement
where did I go wrong?
For starters your syntax is all wrong
Field 8 need not always be the command, sometimes it can be field 7 (check the output of ps -ef)
My advice to you is to take look at the Proc::ProcessTable module http://search.cpan.org/author/DURIST/Proc-ProcessTable-0.38/ProcessTable.pm
thanks, DJ
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]