J
Jeff
i quite a few commands via backticks in my perl programs. i have a
routine that i use to check the $? variable for return status/core
dump/signal values for commands that are at risk of core dumping. the
routine looks like:
sub statCheck
{
my ($childError) = @_;
my ($rc, $core, $sig);
return (undef, undef, undef) if (not defined $childError);
$rc = $childError >> 8;
$core = $childError & 128 ? TRUE : FALSE;
$sig = $childError & 127;
return ($rc, $core, $sig);
}
this works fine most of the time. but if i call a command that
doesn't exist, $? = -1 and this logic blows up. i can put a check in
here for -1 easily enough, but my question to you all is should
backticks be returning -1 ever? if i try running a nonexistent
command from the shell prompt (ksh), i get a return status of 127 (as
the man page for ksh says it should).
thoughts?
jeff
routine that i use to check the $? variable for return status/core
dump/signal values for commands that are at risk of core dumping. the
routine looks like:
sub statCheck
{
my ($childError) = @_;
my ($rc, $core, $sig);
return (undef, undef, undef) if (not defined $childError);
$rc = $childError >> 8;
$core = $childError & 128 ? TRUE : FALSE;
$sig = $childError & 127;
return ($rc, $core, $sig);
}
this works fine most of the time. but if i call a command that
doesn't exist, $? = -1 and this logic blows up. i can put a check in
here for -1 easily enough, but my question to you all is should
backticks be returning -1 ever? if i try running a nonexistent
command from the shell prompt (ksh), i get a return status of 127 (as
the man page for ksh says it should).
thoughts?
jeff