mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-09 14:02:54 +09:00
20 lines
386 B
Perl
20 lines
386 B
Perl
#!/usr/bin/perl
|
|
delete @ENV{qw(PATH)};
|
|
$ENV{PATH} = "/usr/bin:/bin";
|
|
$path = $ENV{'PATH'};
|
|
|
|
my $grep_string= $ARGV[0];
|
|
($grep_string) = $grep_string =~ /^([\w]+)$/;
|
|
|
|
chomp $grep_string;
|
|
|
|
if ($grep_string eq '') {
|
|
open(PROCESS, "who | grep -c : |");
|
|
}else{
|
|
open(PROCESS, "who | grep : | grep -c $grep_string |");
|
|
}
|
|
$output = <PROCESS>;
|
|
close(PROCESS);
|
|
chomp($output);
|
|
print $output;
|