Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15079
| From | bashbug@jonkmans.nl |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | $? is -1 |
| Date | 2019-07-05 11:57 +0200 |
| Message-ID | <mailman.200.1562320741.2688.bug-bash@gnu.org> (permalink) |
| References | <20190705095750.46F0D125555@sint.jonkmans.nl> |
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-Det0cS/bash-4.4.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux mine 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu 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? 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." ) Repeat-By: $ bind -x "l":ls bash: bind: l:ls: first non-whitespace character is not `"' $ echo $? -1 $ ( bind -x "l":ls 2>/dev/null ); echo $? 255 $ # This would have worked (but is irrelevant) $ bind -x '"l":ls' # exit 0 $ bind l:self-insert # undo
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
$? is -1 bashbug@jonkmans.nl - 2019-07-05 11:57 +0200
csiph-web