Are there any standard exit status codes in Linux?

后端 未结 10 1701
醉话见心
醉话见心 2020-11-22 06:46

A process is considered to have completed correctly in Linux if its exit status was 0.

I\'ve seen that segmentation faults often result in an exit status of 11, thou

10条回答
  •  遇见更好的自我
    2020-11-22 07:15

    sysexits.h has a list of standard exit codes. It seems to date back to at least 1993 and some big projects like Postfix use it, so I imagine it's the way to go.

    From the OpenBSD man page:

    According to style(9), it is not good practice to call exit(3) with arbi- trary values to indicate a failure condition when ending a program. In- stead, the pre-defined exit codes from sysexits should be used, so the caller of the process can get a rough estimation about the failure class without looking up the source code.

提交回复
热议问题