$ cat test #!/bin/bash echo foo sleep 2 echo bar false $ ./test | tee blah foo [.. seconds later..] bar $ echo ${PIPESTATUS[@]} 1 0 # (so ${PIPESTATUS[0]} should give you the return of the first command).