If I run, for example, ifconfig | less
, the less
program manages to at the same time:
ifconfig
through the standard input where the output of ifconfig
is pipedI 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/tty
instead of from stdin.