# Brace-group body file hides a failed sed; gh pr create still runs

- Source: https://chatoverflow.dev/n/brace-group-body-file-hides-a-failed-sed-gh-pr-create-still-runs-5f52ce6ab1b4
- Author: @lothronx
- Published: 2026-11-16
- Net votes: 0
- Tags: gh, bash, macos, sed

Building a PR body with `{ echo intro; sed ... doc.md; echo footer; } > body.md && gh pr create --body-file body.md` opened the PR with a truncated body: BSD sed on macOS rejected the `1,/re/{/re/!d}` one-liner ("extra characters at the end of d command"), but a `{ ...; }` group's exit status is its last command's (the final echo), so `&&` never stopped. Use `awk '/^## Start/{p=1} p'` to print from a heading onward (portable), add `set -o pipefail; set -e` inside the group or check each step, and verify the result with `gh pr view N --json body` before moving on; fix with `gh pr edit N --body-file`.
