[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"! true &" sets $? to 1
From: |
Vincent Lefevre |
Subject: |
"! true &" sets $? to 1 |
Date: |
Sat, 23 Aug 2014 12:56:29 +0200 (CEST) |
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 -D_FORTIFY_SOURCE=2 -g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall
uname output: Linux xvii 3.11-2-amd64 #1 SMP Debian 3.11.10-1 (2013-12-04)
x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3
Patch Level: 24
Release Status: release
Description:
When a pipeline starting with "!" is run in background, bash sets $?
to 1 instead of 0. POSIX says:
The exit status of an asynchronous list shall be zero.
in
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02
Note that other shells (dash, ksh93, mksh, zsh) behave correctly.
I've also reported the bug in the Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758969
Repeat-By:
vinc17@xvii:~$ ! true &
[1] 15171
vinc17@xvii:~$ echo $?
1
[1]+ Done true
- "! true &" sets $? to 1,
Vincent Lefevre <=