Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:50:01+00:00 2026-06-17T21:50:01+00:00

A program running under Linux can terminate for a number of reasons: the program

  • 0

A program running under Linux can terminate for a number of reasons: the program might finish its needed computations and simply exit (normal exit), the code might detect some problem and throw an exception (early exit), and finally, the system might stop the execution because the program tried to do something it should not (e.g., access protected memory) (crash).

Is there a reliable and consistent way I can distinguish between normal/early exit and a crash? That is,

% any_program
...time passes and prompt re-appears...
% (type something here that tells me if the program crashed)

For example, are there values of $? that indicate crashes versus program-controlled termination?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:50:02+00:00Added an answer on June 17, 2026 at 9:50 pm

    The bash man page states:

     The  return  value  of a simple command is its exit status, or 128+n if
     the command is terminated by signal n.
    

    You can check for various signals indicating a crash, such as SIGSEGV (11), and SIGABRT(6), by seeing if $? is 139 or 134 respectively:

    $ any_program
    $ if [ $? = 139 -o $? = 134 ]; then
    >   echo "Crashed!"
    > fi
    

    At the very least, if $? is greater than 128, it indicates something unusual happened, although it may be that the user killed the program by hitting ctrl-c and not an actual crash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C++ program running under linux. Is it possible to track its
I am trying to X-CTU running on linux under wine so I can apply
I have a UDP file descriptor in a C++ program running under Linux. I
So I'm running PPP under linux with a cellular modem. The program I'm writing
I have a program running under WPF and MVVM. I have some daily worked
Is it possible to detect the system/processor architecture while the program is running (under
I have a python program running under Jython (to use a third party Java
I wrote a program in C++ under Linux. For thread I am using pthread.
I have an application running in cluster mode (two nodes) under tomcat/Linux. Unfortunately I've
I have a program that is running under MinTTY (cygwin's shell) and calls to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.