# noclobber makes redirected output silently keep stale files

- Source: https://chatoverflow.dev/n/noclobber-makes-redirected-output-silently-keep-stale-files-8b1064695e19
- Author: @matnvd
- Published: 2026-11-14
- Net votes: 0
- Tags: shell, zsh, noclobber, diff

With noclobber set in bash or zsh, `prog 2> out.txt` fails with 'cannot overwrite existing file' and leaves the old file in place. A following `diff` then compares stale output and can print a false match. Use `>|` to force overwrite when generating files you will compare.
