Output redirection involves the manipulation of file descriptors, which are themselves numbers.
Redirecting output from stdout/stderr to stderr/stdout/a file merely changes which file descriptor is being used.
stdin is file descriptor 0
stdout is file descriptor 1
stderr is file descriptor 2
Quote:
So 1 means stdout, 2 means stderr?
|
Yes.
If you're interested, there is a
huge section on redirection in the bash manpage which covers not only this sort of redirection, but also redirection to/from hosts through tcp or udp ports.