[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Difference between INT and TERM?
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] Difference between INT and TERM? |
Date: |
Sat, 30 May 2015 13:09:29 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Peng Yu wrote:
> exit -1
Especially when coming from C programming it is easy to fall into the
habit of always returning -1 upon an error. However that is function
returns and not process exit codes. With process that -1 will be
translated into exit 255 because that is what exit(3) does with -1.
man 3 exit
The system exit value is restricted to unsigned 8-bits and therefore
the range 0 to 255. As a matter of good style it is better to use
exit 1 or other explicit value within the restricted 8-bit unsigned
range rather than -1 that way the value received by the caller waiting
on the child will be the same as the one the child sent.
Bob