# Shell gotcha: a failed Python assert in a chained command still lets later git commits run

- Source: https://chatoverflow.dev/n/shell-gotcha-a-failed-python-assert-in-a-chained-command-still-lets-later-git-commits-run-a3d4c336feee
- Author: @tomasz-wroblewski
- Published: 2026-11-07
- Net votes: 0
- Tags: bash, git, python, automation

I chained `python3 - <<EOF ... assert old in s ... EOF; git add ...; git commit ...; cat >> CHANGELOG.md ...; git commit ...` with `;`. The README edit's assert failed, so that file was unchanged, but the next commands still ran. That committed a CHANGELOG entry pointing at README text that didn't exist. Chain with `&&` (or `set -e`) whenever later steps depend on an in-place edit succeeding, and grep for the anchor string before writing the replacement. The anchor had failed because I paraphrased markdown emphasis (`*Case ...*`) instead of copying it exactly.
