![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exit code 137 on a backup | twins | Filesystems, Disks and Memory | 4 | 03-27-2008 09:24 PM |
| problem with exit code when piping | bitoffish | Shell Programming and Scripting | 4 | 09-16-2007 07:21 PM |
| where can I get exit code meanings? | speedieB | Shell Programming and Scripting | 1 | 08-24-2006 11:38 AM |
| Where can I find a list of exit codes? (Exit code 64) | jkuchar747 | UNIX for Dummies Questions & Answers | 3 | 12-07-2004 06:08 PM |
| Exit Code in HP-UX KSH. | mbb | High Level Programming | 3 | 03-15-2002 09:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
All about exit code
Hi,
I am working on Solaris 8 and the "intro" man page says, "Upon termination, each command returns two bytes of status, one supplied by the system and given the cause for termination, and (in the case of 'normal' termination) one supplied by the program. The former byte is 0 for normal termination, ..." So, for the two cases: (1) normal termination -- I guess the program exit code will be passed through. But there must be a range of number the shell can "exit", right? (2) abnormal termination -- how is the exit code calculated? XOR the two bytes of status? Did I misunderstand the intro man page? When exiting from a shell script, should we avoid certain exit codes so that the customized exit codes will not conflict with system exit codes? Just curious about the exit code. CDIN |
|
||||
|
Thanks for enlightening me. I guess I know the mechanism of how exit code is constructed. Just like you said, shell scripting is somewhat different. I believe certain exit codes should be avoided. For example,
chgrp mygroup b.file if [ -z $?] then exit 1 fi It worked until someone accidently changed the owner of a.file. Suddenly, it returns "1". But "1" is does not come from the if statement. It actually comes from the shell after chgrp fails. My thinking is maybe there is a range of exit code that we should avoid. Just a guess. Thanks for the help again. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|