If you pipe a command to another, and want to keep the exit code, you can use one of these 2 ways:
# now you can et the error code in $?
set -o pipefail
Or
echo ${PIPESTATUS[0]}
Developer from somewhere
If you pipe a command to another, and want to keep the exit code, you can use one of these 2 ways:
# now you can et the error code in $?
set -o pipefail
Or
echo ${PIPESTATUS[0]}