Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15080
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: $? is -1 |
| Date | 2019-07-05 09:03 -0400 |
| Message-ID | <mailman.210.1562332015.2688.bug-bash@gnu.org> (permalink) |
| References | <20190705095750.46F0D125555@sint.jonkmans.nl> <d8fba239-dd01-b88b-c489-cfcf75ebb0b9@case.edu> |
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/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: $? is -1 Chet Ramey <chet.ramey@case.edu> - 2019-07-05 09:03 -0400
csiph-web