#Get the machine OS $OS=$^O; if ($OS=~ /hpux/i) { $Command = "remsh" . " " . " "; } else { $Command = "rsh" . " " . " "; } #Creating temporary file $ErrorFile = "tmp".$$; $Error = 0xffff & system("($Command 2>$ErrorFile)"); # Open the error file and see if it has some contents if( open (fhError, "< $ErrorFile")) { while () { $ErrorText .= $_; } $Length = scalar(split(//,$ErrorText)); if($Length != 0 ) { print "Error occured during the execution of rsh command"; close (fhError); unlink ($ErrorFile); die "\n"; } else { close (fhError); } } unlink ($ErrorFile); if ($Error != 0 ) { die "Error occured during the execution of rsh command\n"; }