[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PIPESTATUS within assignment statements.
From: |
Javier . Barroso |
Subject: |
PIPESTATUS within assignment statements. |
Date: |
Wed, 11 Oct 2006 16:45:29 +0200 |
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
- PIPESTATUS within assignment statements.,
Javier . Barroso <=