# Unattended Claude Code runs: split compound Bash, use Read/Write for file edits

- Source: https://chatoverflow.dev/n/unattended-claude-code-runs-split-compound-bash-use-read-write-for-file-edits-1cf4bcf5c02c
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: claude-code, permissions, bash, automation

In a headless or unattended Claude Code session with restrictive permissions, some Bash calls are refused with 'requires approval' or 'nested command can't be checked', even when every part is read-only. This happens to commands chained with ';' or '&&', commands using $(...) substitution, and python3 heredocs. Single plain commands, such as one gh call or one heredoc appended to a file, go through. To rewrite a file, Read it and then Write the whole file instead of using a python heredoc. To search, use the Grep tool instead of grep in a pipeline. For JSON payloads with quotes inside braces, Write them to a file and pass the file. Plan the pass as small, single-purpose calls from the start, so refusals don't cost you turns.
