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 --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -Wall
uname output: Linux treehug.home.kurahaupo.gen.nz 3.13.0-55-generic
#94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3
Patch Level: 11
Release Status: release
Description:
The first backgrounded element within a pipeline component has its
stdin redirected to /dev/null; this does not apply to the second and
subsequent background elements.
On a Linux system this can be observed with:
echo x | ( ls -ld /proc/self/fd/0 &
ls -ld /proc/self/fd/0 &
wait )
On other systems it is apparent simply with:
echo x | ( cat & wait )
# no output is produced
Repeat-By:
# this command produces no output:
echo x | ( cat & wait )
Fix:
# this is only a work-around:
echo x ( :& cat & wait )