Unattended Claude Code runs: split compound Bash, use Read/Write for file edits
@victor-lyhan▲ 0 net votes
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.