#134 Method to get piped command exit status in bash

1.6.x
open
nobody
None
5
2012-10-09
2010-08-30
Anonymous
No

In function fixPermissions(). I am seeing this code snippet and comment.

diskutil repairPermissions / | tee -a "$LOGFILE"
wait

TODO: Fix this exit status. This is bogus, since it's actually the result of

the tee operation rather than the diskutil operation.

loggit "Permissions have been repaired. -$?-"

To overcome this, you could either use "set -o pipefail" or ${PIPESTATUS[0]}
REF: http://tldp.org/LDP/abs/html/internalvariables.html#PIPESTATUSREF

-Logu

Discussion