Re: Capturing verbose exit codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03Apr2010 17:07, Dave Ihnat <dihnat@xxxxxxxxxx> wrote:
| On Sat, Apr 03, 2010 at 01:53:40PM -0700, Suvayu Ali wrote:
| > Whenever some job is sent to the background and it finishes, it displays 
| > a message on the shell with the exit code. ...
| > ...
| > I understand that I can get the exit code with $? but is there some way 
| > I can get the associated message (Done/Terminated/Sementation Fault...) 
| > with the exit code?
| 
| Unfortunately, every exit code is a function of the individual program
| that last ran, or the shellscript itself.  Do a man on the various
| commands; you'll find a wide range of exit codes.  About the only thing
| you can really count on--usually--is that an exit code of zero means
| everything was OK.

However, in the context of Suvayu's query (getting the _shell_'s job
control messages) the codes are universal, since the shell's knowledge
is as non-specific as you describe.

So the shell can report Terminated and Segmentation Fault reliably and
Done versus failed because the wait status has distinct information.
So he should be able to check done versus failed ($? == 0 versus
nonzero), and he may find the shell returns negative values for
"terminated by signal N". Core dumps may not be exposed by the shell.

Suvayu: try this:

  sleep 3600 &
  kill -9 $!; wait; echo "\$?=$?"

and repeat with various kill numbers. See if you get anything useful.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Network Planning Constraint Of The Month:
        You can't send bits over a non-existant link.
                - Valdis Kletnieks <valdis@xxxxxxxxxxxxxxx>
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux