On Wed, 10 May 2006 13:17:21 -0500 Mark Rolen <[EMAIL PROTECTED]> wrote:

> Luke Bakken wrote:
> >> cmd1 2>&1 >$WHERE
> > 
> > This doesn't do what you think it does, which I'm assuming is redirect
> > stderr and stdout to $WHERE.
> > 
> 
> What does it do?  I was of the belief that it is indeed doing the above,
> and the log/scratch files I redirect to have always seemed to back that
> up, showing both stdout- and stderr-looking output.

Are you sure about that?
$ cat foo 2>&1 > asd
cat: foo: No such file or directory
$ cat asd
$ 

Doesn't look like stderr is getting redirected to the file.

> know, and if there's something wrong with doing "2>&1 >" then what is
> the correct method?

"> file 2>&1" is the correct method.
$ cat foo > asd 2>&1
$ cat foo
cat: foo: No such file or directory
$ 

The shell reads args left to right.  So "2>&1 >file" means you redirect
stderr to stdout, but they are already both your term, so it doesn't do
anything.  Then after that you redirect stdout into a file, and stderr
is still to your term.

Adam

Reply via email to