a=$(COMMAND1 | COMMAND2 | COMMAND3)

How can I get return status from COMMAND2?
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2
uname output: Linux pepinux 2.6.18-1-686 #1 SMP Mon Sep 25 00:42:11 UTC 2006 
i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.1
Patch Level: 17
Release Status: release

Description:
        host$ a=$(COMMAND1 | COMMAND2 | COMMAND3)
        host$ echo ${PIPESTATUS[1]}
        returnstatus_command2
        host$   

Repeat-By:
        host$ a=$(COMMAND1 | COMMAND2 | COMMAND3)
        host$ echo ${PIPESTATUS[1]}

Fix:
        host$ set -o pipefail or anything similar
        


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to