5 ms·
You're wrong. I think the bike shed should be blue. ;)
by pkulak 8y ago
You're wrong. I think the bike shed should be blue.
;)
- koolba 8y agoNo GP is correct. Control-D sends an EOF (end of file) which indicates there is no more input. This isn’t bike shedding at all as there’s a specific character code to indicate you’ve finished with a program and it’s standardized on all sane pieces of software. Heck it even works with things that aren’t specifically programmed to “exit” as they’ll simply end the stream on receipt.
- viraptor 8y agoThis isn't really about alternatives. Bike shedding could be about exit-vs-quit or similar. Ctrl-d exists a layer above though. In a typical terminal / readline, your process will get an EOF / HUP signal which is treated like a clean-exit in most interactive cases and config-reload in many servers. Just like ctrl-c generates INT and ctrl-z generates STP. This is worth learning.
- colanderman 8y agoDon't forget Ctrl-\. For when you feel like Ctrl-C is too nice. (It sends SIGQUIT.)
- majewsky 8y ago> Just like ctrl-c generates INT and ctrl-z generates STP. It's very different. Ctrl-D does not generate signals. When written into the tty master, it forces the kernel to answer any pending read() syscalls on the tty slave, even if it means returning 0 bytes. Programs then apply the convention of treating a read() that returns 0 bytes as meaning EOF (because that's how it works with all other file types that are not tty slaves).