Retrieve N-th piped command exit status

This commit is contained in:
Cedric Dufour 2015-09-04 10:16:54 +02:00
parent 8f0d2e9fc3
commit b3a93bc128

View File

@ -18,3 +18,7 @@ set -x
# Turn off debugging:
set +x
# Retrieve N-th piped command exit status
printf 'foo' | fgrep 'foo' | sed 's/foo/bar/'
echo ${PIPESTATUS[0]} # replace 0 with N