Linux: Understanding File Descriptors and IO Redirection
symkat.com
symkat.com
Incorrect. The file descriptors exist in kernel memory, and user code simply refers to them by number. (Sure, you have to allocate memory for the number, but that's not necessarily done by libc.)
After all these years using Linux, I don't remember ever noticing input redirection.
http://groups.google.com/groups?q=Useless%20Use%20of%20Cat%2...
(actually his main point was that most unix commands take a file as an arguments, but for the ones that don't you can just slurp it into stdin with `<')
Nowadays, we could say the same thing about useless uses of `echo', given the modern `<<<' operator.
Also it has a lot more IO redirection and not really much file descriptors except for the very beginning. The description of how redirection works is rather vague. There should be something about how the shell dup()'s over standard file descriptors to create redirection.
The things in the article are explained on their own level, and then a level below it, i.e. the file descriptors. How the file descriptors work, where they're stored, things like that, are well out of the scope of the article.
IMO.
standard input/output/error are not necessarily character devices (as stated in the article). they can be anything (sockets, files, etc).
That's a lot of typing to implement echo in perl.