[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $? is -1

From: Chet Ramey
Subject: Re: $? is -1
Date: Fri, 5 Jul 2019 09:03:06 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

On 7/5/19 5:57 AM, bashbug@jonkmans.nl wrote:

> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
> Description:
>       Two related issues, regarding negative exit status.
>       First, I always thought that the exit status, $?, was in the 0-255 
> range.
>       ( wait4 int argument for status masked with 0377 ) 
>       But I got a -1 in the exit status of (builtin command) bind.
>       Is this a bug or wanted behaviour?

It certainly seems like a problem.

>       Second, when ran in a subshell, the same exit status gets mapped to 255.
>       While logical, as -1 gets mapped to 255, it seems inconsistent.
>       ( from the manual: "The return status is the exit status of list." )

It's the difference between passing a status around the shell and passing
it through the waitpid() interface, which takes just eight bits.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]