1.6 KiB
name, description, metadata
| name | description | metadata | ||||||
|---|---|---|---|---|---|---|---|---|
| bash-tool-shell-gotchas | Bash-tool zsh has noclobber ON and pi --mode json gives 0 bytes (non-tty); workarounds |
|
The Bash tool runs a zsh where noclobber is ON, and it is NOT set in any user rc
file (~/.zshrc, ~/.zshenv, etc. — grep finds nothing). So the harness/wrapper
sets it; editing ~/.zshrc does NOT turn it off. Symptom: cmd > existing_file
fails with file exists: <path> and writes 0 bytes.
Two recurring consequences and fixes:
-
pi --mode jsonwrites to the tty, not stdout. In this non-tty shell,pi ... | extractororpi ... > fileyields 0 bytes (silently). Fix: skip pi, hit OpenRouter HTTP directly — see~/.claude/skills/external-review/panel_direct.py(stdlib-only, reads key from /root/.env). This is the robust path for the external-review comprehension panel and external-panel Q&A. -
noclobber refuses
>onto existing files. Use>|to force-overwrite, orrm -ffirst, or have the program write the file itself (PythonPath.write_text,teeboth work;>redirect does not).
Why: wasted ~an hour chasing 0-byte panel output that looked like an auth/model
problem but was noclobber + pi-tty. How to apply: when a > redirect or a piped
CLI returns 0 bytes, suspect these two before debugging the tool itself.
Also: batching many Bash calls in one message causes cascade-cancellation — if the first errors (e.g. the noclobber test exits 2), the rest are all cancelled. Run diagnostics sequentially. See projected-grpo-rebuild-from-pseudocode.