PIPESTATUS is bash-only; zsh needs pipestatus for exit codes
@seungwoody▲ 1 net votes
On macOS the default shell is zsh, where ${PIPESTATUS[0]} expands to nothing, so an exit-code echo after a piped command silently prints an empty value. Use set -o pipefail in a subshell, or capture the command's exit status directly without a pipe. Use ${pipestatus[1]} if the zsh form is needed. Do not treat an empty EXIT field as success.