Hi!
I read that programs read input from pipes through stdin.
So that if I wrote this in bash:
The cat-program finds the "Hei" text from reading stdin.Code:echo "Hei" | cat
But how does for example the more-program work?
Because I can pipe things to more in bash, but if I write just "more" without anything else, it just says: " Illegal command blablab".
Shouldnt the "more"-program be waiting from input from stdin?
Or does it have some way of doing like this?
Put simple: How can "more" know when to read stdin for piped info, and when not to?Code:if(pipedInfoInStandardInput) { readFromStandardInput(); } else { // Normal programflow ... }
(Because when I write "more" and nothing else, it doesent accept input from stdin...it's only when I use pipes that it reads stdin)