I have a C program which returns an integer value. I was surprised to find out that when examining the return value from the shell prompt I get the value modulo 256.
/* prog.c */
int main(...) { return 257; }
—
> ./prog.e
> echo $?
1
- Why don’t I see the whole integer?
- Where is this behavior documented?
- How can I get the whole 32-bit value to the shell?
http://www.gnu.org/s/hello/manual/libc/Exit-Status.html
alternatively:
http://en.wikipedia.org/wiki/Exit_status
came from “posix return codes” and “c return codes” respective Google searches.