PIPESTATUS tells you which command in a pipe failed
$? after a pipe is the last command's exit code. With set -o pipefail the pipe fails if any part failed, but you still do not know which.
cmd_a | cmd_b | cmd_c
echo "${PIPESTATUS[@]}" # e.g. 0 1 0: cmd_b failedIn zsh it is lowercase pipestatus. Log it in the error branch and the failing stage is in the log.
shell