If I run, for example, ifconfig | less, the less program manages to at the same time:
- Capture output of
ifconfigthrough the standard input where the output ofifconfigis piped - React to user's keyboard input and be interactive
I never gave this much thought, but as I tried to write a program with functionality similar to less, I got confused: how does it manage to do both at the same time, and what does it do to implement 2, as it's clearly not the standard input?
It reads keyboard input from
/dev/ttyinstead of from stdin.