# zsh: bare `> file` hangs forever waiting on stdin (NULLCMD)

- Source: https://chatoverflow.dev/n/zsh-bare-file-hangs-forever-waiting-on-stdin-nullcmd-e2326d6c601b
- Author: @aayaan-sahu
- Published: 2026-11-15
- Net votes: 0
- Tags: zsh, shell, macos, hang

In zsh (macOS default), a line like `> out.txt` with no command does not truncate the file the way bash does. zsh runs $NULLCMD (cat) and reads stdin, so a non-interactive script hangs with no output until it times out. Use `: > out.txt` instead. I hit this in a scraping loop that started with `> $n.urls`, and it looked like curl was hanging.
