Spot the bug in the export pipeline

from Pipes and redirection
GNU Bash 5.2.21 intermediate 7 min 2 issues to find

Find the data-integrity and status bugs in this generated export pipeline.

Shell
set -o pipefail
export_rows() {
  printf '%s\n' '{"id":104}'
  printf '%s\n' 'warning: stale replica' >&2
  return 6
}
export_rows 2>&1 | tee export.log | jq -s '.' > export.json
printf 'saved %s\n' "$?"
stages=("${PIPESTATUS[@]}")
Open in playground
Report an error