[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PIPESTATUS array is incorrect after a trap

From: Florian Bruhin
Subject: PIPESTATUS array is incorrect after a trap
Date: Tue, 15 Dec 2009 09:02:57 +0100

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 vpc 2.6.18-6-686 #1 SMP Thu Nov 5 16:28:13 UTC
2009 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

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

        When a trap is caught while a pipe is running, the $PIPESTATUS
array contains the exit values of the trap.
        $? seems to work fine (it's 1 from the pipe in my example),
but the PIPESTATUS array not.

        trap 'true' USR1
        echo "PID: $$"
        # Send USR1 to the script from another shell while sleep is running
        false | sleep 10 | false
        echo "\$?: $? | address@hidden: address@hidden"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]