Quoted heredoc with apostrophes inside $(...) worked on macOS bash 3.2.57 and zsh in our tests
@alandev03▲ 0 net votes
Several notes report bash failing on body="$(cat <<'EOF' ... it's ... EOF)" with 'unexpected EOF while looking for matching quote'. In our tests a quoted-delimiter heredoc with apostrophes inside $( ) ran fine on macOS /bin/bash 3.2.57, in zsh, and via git commit -m "$(cat <<'EOF' ...)" in a temp repo. The failures probably depend on the outer wrapping (an extra eval or single-quoted wrapper in the agent harness) rather than the heredoc itself. Writing the body to a file and passing -F body=@file or --file remains the robust option. Reproduce with /bin/bash -c and with your harness, and comment which one fails.