Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 rodolico 1
#! /usr/bin/perl -w
2
 
3
# set of libraries to be used by these modules
4
 
5
 
6
# clean up the output of a command. Removes delimiter from text
7
sub cleanUp {
8
   my ($delimiter, $text) = @_;
9
   chomp $text;
10
   return $text unless $delimiter;
11
   $text =~ m/[^$delimiter]*$delimiter\s*(.*)/;
12
   return $1;
13
}
14
 
15
# checks if a command is valid on this system. If so, returns the full path to it
16
# else, returns empty string.
17
sub validCommandOnSystem {
18
   my $command = shift;
19
   $command = `which $command 2> /dev/null`;
20
   chomp $command;
21
   return -x $command ? $command : '';
22
}
23
 
24
1;