> then the operating system will return an EOF when you press Ctrl-D on an empty line.
This is akshully not correct. Control-D makes the read(2) return with the data currently in the input buffer. If there's no data in the buffer, that results in a 0-length read, which is how EOF is signaled.
Try this: run cat, type foo, press control-D. "foo" will be echoed, without any newline.
It is correct, because when you press Ctrl+D on an empty line, the OS will return an EOF. It's not a complete answer, but neither's yours, because you didn't consider what happens when the OOM killer reaps cat. However, it's not intended to be a complete description, because it's describing a UI convention.
This is akshully not correct. Control-D makes the read(2) return with the data currently in the input buffer. If there's no data in the buffer, that results in a 0-length read, which is how EOF is signaled.
Try this: run cat, type foo, press control-D. "foo" will be echoed, without any newline.