Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14619 > unrolled thread

Special parameter ?

Started byesoriano@gsyc.urjc.es
First post2018-09-21 13:23 +0200
Last post2018-09-21 13:23 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  Special parameter ? esoriano@gsyc.urjc.es - 2018-09-21 13:23 +0200

#14619 — Special parameter ?

Fromesoriano@gsyc.urjc.es
Date2018-09-21 13:23 +0200
SubjectSpecial parameter ?
Message-ID<mailman.1081.1537534198.1284.bug-bash@gnu.org>
The man page of bash (Special Parameters section) says:

   ? expands to the exit status of the most 
   recently executed foreground pipeline.

Nevertheless, background commands also modify the
value of this variable. 

Example:

esoriano@omac:~$ false
esoriano@omac:~$ sleep 2 &
       (wait 3 seconds)
esoriano@omac:~$ echo $?
0
esoriano@omac:~$  

In this example, the most recently executed foreground 
command is false, so the value of $? should be 1.

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-vEMnMR/bash-4.4.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security
uname output: Linux omac 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 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:
	[Detailed description of the problem, suggestion, or complaint.]

Repeat-By:
	[Describe the sequence of events that causes the problem
	to occur.]

Fix:
	[Description of how to fix the problem.  If you don't know a
	fix for the problem, don't include this section.]

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web