News for hackers. Stuff that matters.
Re:A shell colon does nothing. Use it anyway. by kazinator on Sunday July 26, 2026 @11:41PM (#49064962)
> : < missing.json; echo AFTER # <- this will not

This is required by POSIX in the section "Consequences of Shell Errors". If a redirection error occurs in a special built-in command, a non-interactive shell is required to exit.

The bare redirection without : does not have this problem:

  < missing.json; echo AFTER
Therefore, in a POSIX-conforming shell, we do not need to wrap it in a subshell.

> but your message is factually wrong - on so many levels.

How many? Can you count the levels? I didn't know that in zsh "< file" dumps to standard output, which is suppressed by :. If I used Zsh, I would know that sort of thing.

There are no comments on this comment yet.