Skip to content

Fix awk 'newline in string' error in ensure_block function#86

Draft
adrw wants to merge 1 commit into
masterfrom
adrw/fix-zshrc-awk
Draft

Fix awk 'newline in string' error in ensure_block function#86
adrw wants to merge 1 commit into
masterfrom
adrw/fix-zshrc-awk

Conversation

@adrw

@adrw adrw commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix bug where the ensure_block function fails with "awk: newline in string" error when processing .zshrc
  • The awk command with -v c="$content" doesn't handle multi-line content properly
  • Replace with a simpler line-number based approach that finds marker positions and reconstructs the file without awk

Test plan

  • Run setup.sh on a macOS machine with an existing .zshrc containing ### BEGIN adrw-dotfiles markers
  • Verify Zsh setup section completes without errors

🤖 Generated with Claude Code using minimax-m2.5@iq2_xxs in 114m + 139m to create the PR

The awk command with -v c="$content" fails when content contains literal
newlines because awk doesn't handle multi-line variables properly. Replace
with a simpler line-number based approach that finds marker positions and
reconstructs the file without awk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adrw adrw marked this pull request as draft March 8, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant