Need help figuring out what is wrong with a simple script that I just wrote. I am trying to get a handle on a network that I just became in charge of that has no documentation, now I have a large list of hostnames that I am trying to get the complemented hostid's for but am having some issues getting Perl to run a command. Line Eighteen is the problem line, where I am trying to loop my rsh command to each entry in the hostfile that I have and retain information regarding the hosted and place that into a file. DZEditor is stating that my syntax is proper but that still does not tell me much as to why this is not working. Any help would be grateful. OS is Solaris 7 & IRIX.

 

#!/usr/bin/perl -w
#Reads in a list of hostnames and then using rsh goes out
#to the network and finds there hostid's
#
#Jared Dame 11-27-01

open (FILE,
"/var/list") or die "can't open list file:$!";
open (OUTPUT,
"/usr/bin/rsh") or die "RSH not Found:$!"; #path

while ($_ = <FILE>)
{
 next if /^
#/; #Skips commented out lines
 next if /^$/;
#Skips empty lines
 s/\s*
#//;    #deletes comments
 s/\s*$//;   
#deletes white space
 $rsh = <OUTPUT>;

 $results =
'$rsh $_;hostid;>>results.file'; #This just prints out what is contained in ''
 print
"$results\n"; #I am only using this to see what is being done at run time.

}

Thanks,

 

Jared M. Dame

Field Engineer

SAIC

 

Reply via email to