On 8/12/10 6:37 PM, lstee...@gmail.com wrote:

> Bash Version: 4.1
> Patch Level: 7
> Release Status: release
> 
> Description:
>       PIPESTATUS never shows more than 1 array element after executing a 
> multiple command pipe
> 
> Repeat-By:
>       Execute the following script:
> 
> #!/bin/bash
> #
> # A script to test PIPESTATUS and pipefail
> #
> echo "   cmd: set +o pipefail"
> echo "  pipe: ps -ef 2>&1 | grep "^\$USR" >/dev/null"
> set +o pipefail
> ps -ef 2>&1 | grep "^$USR" >/dev/null
> echo "expect: PIPESTATUS = 1 0 \$? = 0; got: PIPESTATUS = ${PIPESTATUS[*]} 
> \$? = $?"
> echo
> echo "   cmd: set -o pipefail"
> echo "  pipe: ps -ef 2>&1 | grep "^\$USR" >/dev/null"
> set -o pipefail
> ps -ef 2>&1 | grep "^$USR" >/dev/null
> echo "expect: PIPESTATUS = 1 0 \$? = 1; got: PIPESTATUS = ${PIPESTATUS[*]} 
> \$? = $?"
> echo
> echo "  pipe: ps aux 2>&1 | grep "^\$USER" >/dev/null"
> ps aux 2>&1 | grep "^$USER" >/dev/null
> echo "expect: PIPESTATUS = 0 0 \$? = 0; got: PIPESTATUS = ${PIPESTATUS[*]} 
> \$? = $?"
> echo "expect: PIPESTATUS = 0 \$? = 0; got: PIPESTATUS = ${PIPESTATUS[*]} \$? 
> = $?"
> #
> # End of script
> 
> None of the 'got' results 'expect'ing multiple PIPESTATUS results work.

Interesting.  I can't reproduce it.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to