Menu

#133 Method to get piped command exit status.

1.6.x
closed
nobody
None
5
2018-05-02
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

  • Kristofer Widholm

    Thank you Logu. This has been changed in commit 354455cb46b6672739540ec538bd46f3cb81dec6.

     
  • Kristofer Widholm

    • status: open --> closed
     

Log in to post a comment.