Hi,

In my perl script p1 i am calling another script p2 which logs into a
remote machine and executes a script p3. The $file defined in p3 does
not exist. So copy operation in p3 will error out with error code 256
and p3 stops execution with exit staus 256. But p2 is not able to
recieve this value. I need the value 256 in p2. Could any one help me
to sove this..

p1
===
........
........
system(p2 $opt);
if ($? == 0) { print "success"; }
elsif ($? == 1) { print "failure"; }
else { print "Undefined exit status"; }
........
........

p2
===
use Net::Telnet;

$t = new Net::Telnet();
$t->open("machine");
$t->login("user","paswd");
$t->cmd("p3 $flag");
$t->close();

print "Check : $?";                            // prints $? value as
0;
if ($? == 0) { exit(0); }
elsif ($? == 1) { exit(1); }
else { exit($?); }


p3
===
my $file  = "/hom/user/file";
.....
......
system(cp -rf $file $backup);
unless($? ==0)
{
   print "Failed to create the back up with exit_status $?";   //
prints $? value as 256.
   exit($?);
}
.....
....


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to