I bet the child gets killed by a SIGPIPE (13) in the gzip case.
See system for how to properly interpret $? to also catch such errors (the signal number is in the lower byte which you're just "shifting out" by unconditionally doing $? >> 8).
In reply to Re: Exit codes from forking children
by almut
in thread Exit codes from forking children
by DustinLundquist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |