All, 

I want to capture the exit value of a system call.  How can I do this? 
My code is:

system  ( " cat /tmp/foo" );
        if ( $? == 0 ) {

                blah blah blah
        }


I read the cookbook  and it says :

Both wait and waitpid return the process ID that they just reaped and set $? to the 
wait status of the defunct process. This status is actually two 
8-bit values in one 16-bit number. The high byte is the exit value of the 
process. The low 7 bits represent the number of the signal that killed the 
process, with the 8th bit indicating whether a core dump occurred. Here's 
one way to isolate those values:
$exit_value  = $? >> 8;
$signal_num  = $? & 127;
$dumped_core = $? & 128;


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams

Reply via email to