Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: getting the bash exit code

by Perlbotics (Archbishop)
on Aug 24, 2012 at 18:54 UTC ( [id://989613]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if ($? == -1) {
                    print "failed to execute: $!\n";
    ...
            printf "child exited with value %d\n", $? >> 8;
         }
    
  2. or download this
    Bit# 15 14 13 12 11 10 09 08  07 06 05 04 03 02 01 00
          |  |  |  |  |  |  |  |   |  |  |  |  |  |  |  |
    ...
          +-- exit code (8bit)     |  +-- signal code (7bit)  
                                   |
                                   +-- core-dumped flag
    
  3. or download this
    my $exit_status = int( $? / 256 ); # quick and dirty exit-state
                                       # decimal arithmetic so to speak
                                       # (works for positive numbers)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://989613]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-19 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found