4 ms·
Interestingly, there are some circumstances where you actually want "cat file | program" and not "program < file". The case I have in mind is when file is actua
by a3_nm 14y ago
Interestingly, there are some circumstances where you actually want "cat file | program" and not "program < file". The case I have in mind is when file is actually a named FIFO which was not opened for writing. If you use cat, program will still run and only reads to stdin will block (but it can perform other things, possibly in different threads). If you use '<', opening stdin will block and program will probably block altogether.
- ralph 14y agoWith < on a FIFO it's the shell that blocks on opening before the command, e.g. cat, is run.