Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2007 17:34:52 -0000 (GMT)
From:      jhall@vandaliamo.net
To:        "Michael Lednev" <liettneff@bk.ru>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Redirecting STDOUT
Message-ID:  <49457.65.117.48.155.1198258492.squirrel@admintool.trueband.net>
In-Reply-To: <863400045.20071221201413@bk.ru>
References:  <51935.12.170.206.13.1198248568.squirrel@admintool.trueband.net> <1044977630.20071221175247@bk.ru> <49254.65.117.48.155.1198256367.squirrel@admintool.trueband.net> <863400045.20071221201413@bk.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

> In that case you only redirecting STDERR to file. As you've been
> already told STDOUT will be redirected with
>
> $ command 1>file
>
> or
>
> $ command > file
>
> adding 2>&1 will also redirect STDERR to this file
>

When I run this as a non-root user it works fine.  But, when running it as
root, it does not produce the expected results.

$ ls -l /fjdkslafjdl 2>/home/hallja/test2
And, in the file test2, I see

ls: /fjdkslafjdl: No such file or directory

Running the same command as root, I receive the following results.
# ls -l /fjdkslafjdl 2>/home/hallja/test2
ls: /fjdkslafjdl: No such file or directory

And, in /home/hallja/test2 I see the following.
-rw-r--r--  1 root  hallja  0 Dec 21 08:02 2

Why does this not work as root?

Thanks,


Jay




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49457.65.117.48.155.1198258492.squirrel>