stdin, stdout and stderr

Most UNIX programs read their input from a `file descriptor' known as `standard input' (stdin) and send their output to `standard output' (stdout). Any error messages are sent to `standard error' (stderr). Usually stdin is the keyboard, and stdout and stderr are the screen. Sometimes it is useful to redirect these so that a program can take its input from somewhere else, or send its output elsewhere. You have already seen this used when we looked at printing files (see section 2.2.13, page [*]). There are more details about this in the manual pages for bash, but some of the possibilities are explained in the following sections.



Loc Van Huynh 2007-03-15
Please complete our new website survey