|
|
What is stdin? What is stdout? What is stderr? |
| They're called file descriptors.
stdin, standard in, refers to the data stream that is going into a process, which is, by default, taken from the keyboard. But the data characters can be taken from a file, instead, and that's an example of redirecting standard input from a file. stdout, standard out, refers to the data stream that is coming from a running process. By default, stdout is directed to your screen. Commands like 'ls' and 'cat' display their output to stdout. stderr, standard error, refers to the data stream of error messages being generated by a process. The registration nag displays itself to stderr, which is usually the console, ctrl-alt-esc. Often stderr is sent to the same place that stdout is directed to.
stdin, stdout and stderr can all be redirected. How to implement this is dependent on your shell. Example of redirection with the Bourne shell.
./configure > con.log 2>&1 *Would be a stdout redirect to the file
con.log and a stderr redirect to
stdout's destination. When both
stdout and stderr go to the same
file, you see nothing on the screen.
> /dev/null *Would be stdout sent to the null device Double << >> 2>> *Would append
pkgchk -n base 2>&1 > /tmp/printout *Would be a stdout redirect to /tmp/printout, and a stderr redirect to stdout's destination
| |
| [Append to This Answer] |
| Previous: |
|
| Next: |
|
| ||||||||