Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does exit code status with zero value always mean successfully run in Perl?

I have a Perl script that will execute three applications. All of it have different exit code status.

First application exit code status is 1. The application exited normally without any problem. (Successful)

Second application exit code status is 99. Still, the application exited normally without any problem. (Successful)

Lastly, the third application exit code status is 0. The same with the first and second, the application exited normally without any problem. (Successful)

Note: Already shift the exit code status 8 bits to right.

Question is, does the exit code status always return to 0 if successfully run?

Please no harsh comment, I just confused. Please advice.

like image 581
quinekxi Avatar asked Mar 23 '12 06:03

quinekxi


2 Answers

The return status is chosen by the child process. It is conventionally zero for successful operation but there is nothing to enforce that convention.

It is also possible for processes to return informational return statuses which indicate different forms of success. For instance, a program that modified all files in a directory may return a non-zero value to say that there were no files to modify.

You should check the documentation of the applications to see if anything is mentioned about what values may be returned. If you can find nothing then you should decide empirically what values indicate success.

like image 180
Borodin Avatar answered Oct 06 '22 23:10

Borodin


Most operating system environments suggest and provide support for zero as a successful exit code, and other values indicating some sort of status: whether ordinary or exceptional is documented individually for each program.

Even simplistic MSDOS provides good support for a batch file to react to a certain errorlevel and do something different.

One environment which has strong default reactions to a non-zero return status is the VMS/OpenVMS operating system family. If your application(s) might run there, please follow the standard.

like image 30
wallyk Avatar answered Oct 06 '22 21:10

wallyk