On a bash command line in Ubuntu 14.04 :
echo "z" | grep -e 'x' ; echo $PIPESTATUS
always displays 0, even though, obviously, there's no "x" in "z". But:
echo "z" > /tmp/z
grep -e 'x' /tmp/z ; echo $PIPESTATUS
works as I expect, returning 1 if the pattern is 'x' (as shown), and 0 if the pattern is 'z'.
Why?