[EMAIL PROTECTED] wrote:

> Hello, I'm a beginning C/programmer and i have a (rather basic i guess)
> question. The output of stderr is standard the screen. Can I redirect this
> at for example a file ?

Sure.

        command 2>/some/file

The `2>' causes descriptor 2 (stderr) to be redirected. In general,
you can use `N</some/file' and `N>/another/file' for any value of N.

Also:

        command </some/file     is equivalent to        command 0</some/file
        command >/some/file     is equivalent to        command 1>/some/file
        command &>/some/file    is equivalent to        command 1>/some/file 2>&1

The last form redirects both stdout and stderr to the same file (the
notation `2>&1' means `redirect descriptor 2 to the same place as
descriptor 1).

See the bash(1) manpage for more details of redirection. Also see the
dup2(2) manpage for details of the dup2() system call (which is used
to implement I/O redirection).

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to