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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux