Taylor Venable wrote:
[...]
If it did follow the symlink to /dev/null, and tried to read from that
device, it would fail.  You can't (or at least, shouldn't) read from
/dev/null because it's a sink, not a source.  What kind of behavior
would you expect, trying to read from /dev/null?
[...]

Reading from /dev/null wouldn't fail (in the sense of giving a read error): it would give an end-of-file signal. /dev/null is both a source (behaving as always at end-of-file) and a sink (writing to it always succeeds but the data is silently discarded). Try copying /dev/null to a valid but nonexistent filename, and you'll get a zero-length file with no error. Or if the file exists, "cp -f /dev/null filename" will truncate it to zero length.

On Ms-Dos 2 and higher, the NUL device inherited the same behaviour, in (IIUC) conscious imitation of Unix.


Best regards,
Tony.
--
Osborn's Law:
        Variables won't; constants aren't.

Reply via email to