On 4/16/19 10:36 AM, Eric Blake wrote:
> On 4/15/19 4:31 PM, Chet Ramey wrote:
> 
>>
>> The Korn shell uses values > 256 to denote `internal' shell exit statuses,
>> but that violates POSIX.
> 
> No, actually it does NOT violate POSIX.  In fact, POSIX has tried hard
> to permit that ksh behavior, in particular since that extension allows
> an easy distinction between normal exit with 8-bit status and exit due
> to signal.

It's ambiguous.

"When reporting the exit status with the special parameter '?', the shell
shall report the full eight bits of exit status available."

That can be read as restricting the value of $? to eight bits, regardless
of where the status comes from. It doesn't really say anything about the
exit status of, say, a SIGINT at PS1, or a shell syntax error that doesn't
cause the shell to exit, which is why there's so much variation.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to